Solved

Problem Updating TextBox

Posted on 2000-03-15
3
145 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

746 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

9 Experts available now in Live!

Get 1:1 Help Now