Running EXE in VB.NET - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Running EXE in VB.NET

Martok867Martok867 Posts: 2Member
Sorry if this has been posted before but I'm new.

I'm trying to run and EDXE from a button click but nothing happens.
I've tried a few approches but its not working, what am I doing wrong?
As you can see I have just called it via Process.Start as well as defining it as its own process.........

Private Sub APP123_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles APP123.Click

'Enable error-handling routine
On Error GoTo ErrorHandler

'Check the APP123.EXE is in the corredct path
If System.IO.File.Exists(Application.StartupPath & "APP123.exe") = False Then Err.Number = 1
GoTo ErrorHandler

'Open the APP123.exe file
Dim APP123Process As New Process
APP123Process.StartInfo.UseShellExecute = False
APP123Process.StartInfo.WorkingDirectory = Application.StartupPath
APP123Process.StartInfo.FileName = "APP123.exe"
APP123Process.StartInfo.CreateNoWindow = True
'Dim APP123_PATH As String
'APP123_PATH = Application.StartupPath

'System.Diagnostics.Process.Start(Application.StartupPath & "APP123.exe")

Exit Sub

'Error Handling Routine

Select Case Err.Number 'Evaluate the error number.
Case 1 'File is missing
MsgBox("The requested file is missing")
MsgBox("The app startup path is " & Application.StartupPath)

Resume Next ' Resume Execution at the same line that caused the error
End Select

End Sub
Sign In or Register to comment.