Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem Updating TextBox

Posted on 2000-03-15
3
Medium Priority
?
152 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
[X]
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
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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

661 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