Launch External Application and Close main UI Application - VS 200

  • Thread starter Thread starter Ryan
  • Start date Start date
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
 
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
 
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
.
 
Back
Top