Bob,
delcare the m_MainForm WithEvents. Something like:
Private Shared WithEvents m_MainForm as MainTabForm.
Instead of doing the Application.Run, I just invoke the ShowDialog method of
m_MainForm.
In the m_MainForm Closed event invoke Application.Exit()
This works for me.
-Sam matzen
[quoted text, click to view] "Bob" <google.4.oracle@xoxy.net> wrote in message
news:aacb3d3a.0407231029.519e613a@posting.google.com...
> I wrote a simple VB program that runs.
> When I click on the close button in the upper right hand corner
> of the main windows, the program closes. Or at least it appears to.
> The form closes on the the screen.
> If I look in the Task List manager, I can still see my app TTEST.EXE
> running.
> If I start it up again, I get a second instance of TTEST.EXE running.
>
> I thought that if I call Application.Exit this would kill the task but
> it does not.
> How do I properly close my program so that it kills the task?
>
> Here is my startup code.
>
> Public Class Startup
> Private Shared m_MainForm As MainTabForm
>
> ' This class is created so that I take control of the Mainform
> from VB.net
> ' This gives me global access to all members of the form
>
> Public Shared ReadOnly Property MainForm() As MainTabForm
> Get
> Return m_MainForm
> End Get
> End Property
>
> Public Shared Sub Main()
> m_MainForm = New MainTabForm
> Application.Run(m_MainForm) ' Run my MainForm Windows
> m_MainForm.Close()
> Application.Exit()
> End Sub
>
> End Class