Probably a very simple question
I have a form that basically has just a label on it saying "Processing your request" that I want to pop up while (novel idea) it's processing a request. Before the request I show the form using "form.show vbmodal"
and when the processing is done on my main form I run: "form.hide"
But this doesn't hide the form. Am I missing something?
The only workaround I can think of is a bit kludgy. Making a global variable like FormShouldBeOpen as integer and running a timer on the popup to check and see if it should hide.
thoughts?
Re: Probably a very simple question
Why would you hide the form? Shouldn't you simply CLOSE it?
Re: Probably a very simple question
Welcome to the forums. :wave:
Why are you trying to hide? Why don't you just unload it?
Re: Probably a very simple question
Do you use this "processing" form a lot...if so, ignore the others, you don't want to unload it.
I assume the form you are trying to hide is called "form", yes? Stupid question, but it's a valid point :-)
Others might know how vbmodal forms act when you try to hide them, but I've no idea...I'll have a quick play and see and will post in a min
Re: Probably a very simple question
Welcome to VBForums :wave:
The problem is simply that you are showing the form using vbModal - that means the rest of the code will not run until the other form is closed.
If you remove the vbModal , it should work as you want.
It is possible tho for the user to close the other form, so you may want to also set otherform.Enabled = False
Re: Probably a very simple question
Quote:
Originally Posted by smUX
Do you use this "processing" form a lot...if so, ignore the others, you don't want to unload it.
Forms not currently in use should be unloaded.
Re: Probably a very simple question
Dont hide it just unload it. If you need that thing again then show it.
Re: Probably a very simple question
So in other words, using vbModal is useless anyway because it isn't even doing the processing it suggests it is doing :-)
sdk, you could try having the form "always on top" with the message....either with zorder or with an API which would make sure it's always on top of the form :-)
Re: Probably a very simple question
Smux, you are getting way off the original problem. Just unload that thing.
Re: Probably a very simple question
Okay well let me try this. If I take off the modal property it works properly except when the form comes up I just see the title bar and the border. The actual form looks blank. Note: I am viewing this app through Remote Desktop. So I don't know for sure that that's how it actually looks on the screen.
Re: Probably a very simple question
You might need to throw a DoEvents into your code in case your label is not being refreshed.
I would check it out on the actual screen first though.
Re: Probably a very simple question
Yes, programming via remote desktop is laggy and sometimes annoying. I agree with Hack. Try it first on the actual screen.
Re: Probably a very simple question
Quote:
Originally Posted by zynder
Smux, you are getting way off the original problem. Just unload that thing.
If the code to unload it is in the form that loads it, it'll never unload, so smUX's comment was right on the money. You can't load a form modally and then unload it from the form that loaded it.
Re: Probably a very simple question
I must be missing something. :confused:
What's wrong with something like this ?
Code:
Option Explicit
Private Sub Command1_Click()
Me.Enabled = False
frmMsg.Show ', Me
DoProcessing
Unload frmMsg
Me.Enabled = True
End Sub
Private Sub DoProcessing()
'do your processing
End Sub
Re: Probably a very simple question
That is basically what I was suggesting back in Post #3. :sick: