Running EXE in VB.NET

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
APP123Process.Start()
'Dim APP123_PATH As String
'APP123_PATH = Application.StartupPath

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


Exit Sub

'Error Handling Routine

ErrorHandler:
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.

Howdy, Stranger!

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

Categories