|
-
Jul 19th, 2004, 04:26 PM
#1
Thread Starter
Fanatic Member
Confusing DoEvents problem [RESOLVED]
Hi,
I have a program that processes something, then displays a messagebox giving the results.
Now, as soon as the user clicks the okay button on the messagebox, i want the application to end.
The way I have done that is this way:
VB Code:
MsgBox("Done", MsgBoxStyle.Information, "Complete")
Application.Exit()
However I have found that it just seems to exit the application the second it puts the messagebox up. It doesn't wait for the user to press the okay button. I think this is because of the
"Application.DoEvents()" I put at the start of the sub. The problem is tho, i need this for it to show the message box at all. I dunno why, but it's the way i've coded it - very weirdly!!!
So is there a way to make the code just wait for the user to press the okay button on the message box before it processes the application.exit() ?
Thanks very much! I've tried lots of things but nothing seems to work. I either get the messagebox to popup, but the program doesnt end when u press okay. or the current situation where it doesn't come up at all and just ends.
Last edited by LITHIA; Jul 20th, 2004 at 09:40 AM.
-
Jul 19th, 2004, 04:58 PM
#2
PowerPoster
HI,
I've tried but cannot duplicate your result, even with Application.DoEvents in the procedure so I think there must be something else. However, try
VB Code:
If MsgBox("Done", MsgBoxStyle.Information, "Complete") = MsgBoxResult.OK Then
Application.Exit()
End If
If that does not work for you then I suggest you post your sub.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 20th, 2004, 09:39 AM
#3
Thread Starter
Fanatic Member
thanks, i managed to fix it.
i changed the order if which it closed a form. no idea why that altered the messagebox tho.
i think your code helped though, i'm keeping it in.
thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|