Re: Using Form_KeyPress to quit
- From: "Bob Butler" <tiredofit@xxxxxxxxxxx>
- Date: Sun, 7 Jan 2007 06:00:54 -0800
"Willister" <Willister@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6382C860-4BEB-4D9E-990D-D6D2B93A99AA@xxxxxxxxxxxxx
While on the subject, A second problem Im gettting is when the form
loads I have 2 msg boxes pop up. When the game ends, thoose 2
msgboxes popup again, and I cant compile on my version of vb6 so im
not sure how it will affect the final version. heres the code.
As Rick noted, it's hard to tell exactly from the partial code posted. Your
routine does an "Unload Me" but the loop that that is in will continue to
run and any code after it will also run. Somewhere in that code you are
referencing the form or a control on the form. When you do that VB will
reload the form, run the Form_Load event again, and then continue. That
will leave you with the form loaded but not visible and the app won't end
correctly.
When you decide to unload you also need to use 'Exit Sub' and/or set a flag
that other code can check so as to be sure not to reference anything that
will cause the form to reload.
If you put a breakpoint in your Form_Load routine then when it happens the
second time you can use Ctrl-Shift-F8 to step out of the routine and you'll
be on the line of code immediately after whatever triggered it to reload
again.
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
.
- Prev by Date: Re: ActiveControl
- Next by Date: Re: Something like a Project_Activate event?
- Previous by thread: Re: Using Form_KeyPress to quit
- Next by thread: Need help with text parsing program please Quotes error
- Index(es):
Relevant Pages
|