Launch External Application and Close main UI Application - VS 200

R

Ryan

I have a form with one button. When button is clicked; it launched Notepad.exe.
The moment Notepad.exe is launched; I want to close my form (actually
application).
How do I do it?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim myProcess As System.Diagnostics.Process = New
System.Diagnostics.Process()
myProcess.StartInfo.FileName = "Notepad.exe"
myProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
myProcess.Start()

End Sub
 
C

Chris Dunaway

I have a form with one button. When button is clicked; it launched Notepad.exe.
The moment Notepad.exe is launched; I want to close my form (actually
application).
How do I do it?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim myProcess As System.Diagnostics.Process = New
System.Diagnostics.Process()
myProcess.StartInfo.FileName = "Notepad.exe"
myProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
myProcess.Start()

End Sub

Did you try just closing your form? Me.Close()

If that doesn't work, then you can try Application.Exit()

Chris
 
R

Ryan

Yes, I have tried both and they didn't work.


Chris Dunaway said:
Did you try just closing your form? Me.Close()

If that doesn't work, then you can try Application.Exit()

Chris
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top