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!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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