Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

msgbox causes form to disappear and reappear?

Status
Not open for further replies.

LMCRYER

Programmer
Jul 30, 2001
388
US
I have no idea why this is happening, because it didnt happen before - but...

I have a program that has several frames, labels, and cmd buttons on it. Nothing really fancy.

Throughout the program there are several msgboxes that will come up (errorhandling, do you wish to exit, that kind of little stuff) and for some reason when I get a msgbox the form is "disappearing" and only the msgbox shows up. When I hit OK on the msgbox, the form comes back again.

What is causing this to happen???

LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
I forgot to add - this happens sometimes and doesnt others. I cant seem to find the event that is causing it though?

LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
If you post some code maybe I can help.
I'm not sure from what you've described.
But maybe press CTRL+BREAK after the form has disappeared, query ? form.visible in the immediate pane. If this is false, then maybe you can setup a watch to break when form.visible = false. This might reveal what is hiding the form.
mark
 
I am in VA with a client today but will definitely post the code tonight. I will also try what you mentioned here.
It was NOT doing it before - and I ran it several times.
Then all of a sudden, boom! and I cant FIND it...(ugh)
thanks for the input.

LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
ok, here goes. This is what I have coded into my click event for my cmdButton...

Private Sub cmdButton_Click(Index As Integer)
Dim intResponse As Integer


'finalize order (index = 0)
If cmdButton(0).Value = True And mcurSUBTotal > 0 Then
Verify
ElseIf cmdButton(0).Value = True And mcurSUBTotal <= 0 Then
MsgBox &quot;You must finish the order before you can verify it.&quot;, vbOKOnly, &quot;Incomplete Order&quot;
Exit Sub
End If

'index = 1 was a print button - was removed - not required for the assignment

'set the clear button to call the form_load event (clear all data and re-set form)
'this will save on code
If cmdButton(2).Value = True Then
Form_Load
Exit Sub
End If



'Quit button - use msg box to ask user if they really want to exit program
'button will work in 3 ways - shortcut key, this code, or pressing ESC
If cmdButton(3).Value = True Then
intResponse = MsgBox(&quot;Do you really want to end the program?&quot;, vbYesNo, &quot;End the program?&quot;, 0, 0)
If intResponse = vbYes Then Unload Me
ElseIf intResponse = vbNo Then Exit Sub
End If

End Sub LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
JUST FYI - this form disappearing and coming back happens for ANY click events which cause a msgbox to come up - not just the cmdButton listed here. It does NOT happen if I do something with my option buttons, labels, lstbox, or combo box. Just the darn msg boxes??? LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
Question LMCRYER in Va; Does this happen in the compiled version of your program, or only in the IDE? I've seen this same phenomenon in the IDE, but it disappears when
t he program is compiled.

Linq in Va &quot;It's got to be the going,
not the getting there that's good!&quot;
-Harry Chapin
 
Yes, this continued happening until I compiled...actually, first I set form autoredraw to FALSE and that seemed to take care of it.

then after compiling it works GREAT....

I dont know what CAUSED it to start going nuts though becuase it was working just fine until it decided to just go nuts on me! Id like to know what made it misbehave so I can make sure I don't do it again...??

LMC cryerlisa@hotmail.com

select * from Management where proj_mgmt_skills <> NULL

0 records returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top