Solved

Problem Updating TextBox

Posted on 2000-03-15
3
146 Views
Last Modified: 2010-05-02
I am having a problem with setting the value in a TextBox in VB 6.0.  Here is my code where the problem occurs:

        txtStatus.Text = "Saving Spreadsheet as mah_enctr.txt. Please Wait..."
        .ActiveWorkbook.SaveAs "I:\Working_Folder\MAH Encounters\mah_enctr.txt", xlTextPrinter
        .ActiveWorkbook.Close SaveChanges:=False
        .Quit
    End With
   
    txtStatus.SetFocus
--> txtStatus.Text = "Creating MAH Provider and Service Files. Please Wait..."
   
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 1, _
                Shell("S:\Encounter_Data\MAH\MAH.BAT", vbHide))
    Do
        Sleep (2000)
        GetExitCodeProcess hProcess, RetVal
    Loop While RetVal = STILL_ACTIVE

Everything works fine up until the second line that tries to set the value of the TextBox.  The program seems to just totally ignore
this line.  I tried adding the SetFocus line to see if that would fix the problem, but it didn't do anything different.  If I set a breakpoint
and step through this section of code it works fine, but when I run it normally it never Changes the TextBox after the SaveAs.  Has
anyone seen anything like this before, or have any suggestions on what the problem might be?

Thanks,

Brian
0
Comment
Question by:bmaster
  • 2
3 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 2619990
Add this line:

txtStatus.Text = "Creating MAH Provider and Service Files. Please Wait..."
txtStatus.Refresh '<-- Updates the textbox
0
 
LVL 1

Accepted Solution

by:
ndb earned 50 total points
ID: 2620024
txtStatus.Text = "Creating MAH Provider and Service Files. Please Wait..."
Call DoEvents
0
 
LVL 1

Expert Comment

by:ndb
ID: 2620033
BTW, I would also change the code:

Do
   Sleep (2000)
   GetExitCodeProcess hProcess, RetVal
Loop While RetVal = STILL_ACTIVE

In:

Do
   DoEvents
   Sleep (2000)
   GetExitCodeProcess hProcess, RetVal
Loop While RetVal = STILL_ACTIVE

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now