Problem Updating TextBox

Posted on 2000-03-15
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
    End With
--> txtStatus.Text = "Creating MAH Provider and Service Files. Please Wait..."
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 1, _
                Shell("S:\Encounter_Data\MAH\MAH.BAT", vbHide))
        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?


Question by:bmaster
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 32

Expert Comment

ID: 2619990
Add this line:

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

Accepted Solution

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

Expert Comment

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

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


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


Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 2 hours left to enroll

622 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