Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problem Updating TextBox

Posted on 2000-03-15
3
Medium Priority
?
153 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 200 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

927 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