[RESOLVED] Trying to implement a "Please wait" or "loading" window...
Hey all,
I'm having some trouble (which is frustrating b/c it seems so simple) of trying to get a form which says "Please wait" or something like that display while a rather intensive method is running (anywhere from 5-15 secs long).
My code is:
Code:
Private Sub cmdCreateGraphs_Click()
frmMain.Hide
frmLoading.Show
frmGraph.FindUniqueField
frmGraph.Show
frmLoading.Hide
End Sub
With this code, the frmLoading is never hidden. It just keeps staying up there, but if you close it (much after the method has finished running), frmGraph appears with the method complete. I've tried moving around frmLoading.hide all around these 5 lines of code with no success. Also if you document out frmLoading.show/hide, everything works, save an awkward 5-10 secs where a user might think my program crashed.
Any ideas? Thanks
Re: Trying to implement a "Please wait" or "loading" window...
You can change to modal one of your userforms.
Re: Trying to implement a "Please wait" or "loading" window...
If you change to modal doesn't the program wait until the form is closed/hidden?
Break point your code to make sure it is runn as you expect it to.
Might be you need to 'force' the loading of the graph form..?
Re: Trying to implement a "Please wait" or "loading" window...
on your loading form you may be able to implement a timer or two so that it says "please wait" for a couple seconds, and then "loading..."
I've only been programming for a week or so, but I know it would work, it's just a question of is that the look you are going for.
Let me know if you want me to explain it more thouroughly.
Re: Trying to implement a "Please wait" or "loading" window...
Quote:
Originally Posted by pgag45
Hey all,
I'm having some trouble (which is frustrating b/c it seems so simple) of trying to get a form which says "Please wait" or something like that display while a rather intensive method is running (anywhere from 5-15 secs long).
My code is:
Code:
Private Sub cmdCreateGraphs_Click()
frmMain.Hide
frmLoading.Show
frmGraph.FindUniqueField
frmGraph.Show
frmLoading.Hide
End Sub
With this code, the frmLoading is never hidden. It just keeps staying up there, but if you close it (much after the method has finished running), frmGraph appears with the method complete. I've tried moving around frmLoading.hide all around these 5 lines of code with no success. Also if you document out frmLoading.show/hide, everything works, save an awkward 5-10 secs where a user might think my program crashed.
Any ideas? Thanks
It sounds like your frmloading is modal itself, meaning that everything stops until you close the form, at which point the rest of it executes. Make sure the ShowModal property of the frmloading form is False.
zaza
Re: Trying to implement a "Please wait" or "loading" window...
ah ok, didn't know about the showmodal property... I will change that and see if that works tomorrow... thanks!
Re: Trying to implement a "Please wait" or "loading" window...
well that did help a bit...
But with the above code frmLoading appears and disappears at the right time, but the window itself doesn't display anything.... it is all white and looks "frozen".
Re: Trying to implement a "Please wait" or "loading" window...
Use DoEvents to allow Windows to update the graphics.
Re: Trying to implement a "Please wait" or "loading" window...
great, thanks ... working perfect now with this code
Code:
frmMain.Hide
frmLoading.Show
DoEvents
frmGraph.FindUniqueField
frmGraph.lstScenario.Clear
frmGraph.lstSoil.Clear
frmGraph.lstLine.Clear
frmLoading.Hide
frmGraph.Show
thanks all