VB6 Please wait message

In the below code if the user selects OK button of the msg box, it executes 2 functions show1 and scan1. As its a timeconsuming process i need to display a 'please wait' msg for the user.
i tried using frame, but it displays after the 2 funs are run.

testmsg = MsgBox("Try Again,", 1, "Try Again!")
          If testmsg = 1 Then
           waitFrame.Visible = True
             show1   //function1
              scan1   //function2
             Exit Sub
             Else
             Exit Sub
 waitFrame.Visible = false
End If

AnnaJames77Asked:
Who is Participating?
 
Farzad AkbarnejadDeveloperCommented:
Hello,
Place DoEvents statement before running show1.

testmsg = MsgBox("Try Again,", 1, "Try Again!")
If testmsg = 1 Then
    waitFrame.Visible = True
    DoEvents
    show1   //function1
    scan1   //function2
    Exit Sub
Else
    waitFrame.Visible = false    
    Exit Sub
End If


-FA
0
 
AnnaJames77Author Commented:
THANK YOU THANKYOU FarzadA: that worked. Can you please let me know what does the doevents used for?
0
 
Farzad AkbarnejadDeveloperCommented:
Hello,
DoEvents switches control to the operating-environment kernel. Control returns to your application as soon as all other applications in the environment have had a chance to respond to pending events. This doesn't cause the current application to give up the focus, but it does enable background events to be processed. Other applications also includes other window (Windows and Controls) in your VB application.

-FA
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.