Why does this code close both of my WinForm windows???

  • Thread starter Thread starter Aaron Ackerman
  • Start date Start date
A

Aaron Ackerman

I have a code snippet where if a certain condition is met it creates and
loads an instance of a form and closes the active form that called the
smaller one. The problem is when I call me.close it closes BOTH forms?


Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()
 
* "Aaron Ackerman said:
I have a code snippet where if a certain condition is met it creates and
loads an instance of a form and closes the active form that called the
smaller one. The problem is when I call me.close it closes BOTH forms?

Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()

Maybe your application is loosing its message pump.

For a solution, see:

<http://www.google.com/groups?selm=u#[email protected]>
 
Aaron Ackerman said:
I have a code snippet where if a certain condition is met it creates
and loads an instance of a form and closes the active form that
called the smaller one. The problem is when I call me.close it closes
BOTH forms?


Dim frmWizard As New DBWizard

frmWizard.Show()

frmWizard.Focus()

Me.Close()

If you specified the first form as the startup object, the application
closes as soon as the form is closed. If you want a different behavior, you
need to write a Sub Main on your own:

shared sub main
dim f as new form1
f.show
application.run
end sub

Now, you have to call application.exitthread when you want the application
to quit.
 
My apologies but that is a lousy solution.

Armin Zingler said:
If you specified the first form as the startup object, the application
closes as soon as the form is closed. If you want a different behavior, you
need to write a Sub Main on your own:

shared sub main
dim f as new form1
f.show
application.run
end sub

Now, you have to call application.exitthread when you want the application
to quit.


--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top