View Single Post
  #16  
Old 14-04-2017, 09:18
felice2011's Avatar
felice2011 felice2011 is offline
Registered User
 
Join Date: Feb 2011
Location: italy
Posts: 836
Thanks: 357
Thanked 1,158 Times in 390 Posts
felice2011 is on a distinguished road
Quote:
Originally Posted by bairagyakushal4 View Post
I wrote code myself but its not working, can't seem to fix the error, please help.(Visual Studio 2015)

Attachment 18037

Attachment 18038


Code:
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If My.Computer.FileSystem.FileExists("G:\Back to the Future - The Game\Episode 1\BackToTheFuture101.exe") Then
            Shell("G:\Back to the Future - The Game\Episode 1\BackToTheFuture101.exe")
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 1")
        End If
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Dim intResponse As Integer

        intResponse = MsgBox("Are you sure you want to " _
& "Exit?",
vbYesNo + vbQuestion + vbDefaultButton2,
"Exit?")

        If intResponse = vbYes Then
            Me.Close()
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If My.Computer.FileSystem.FileExists("Episode 2\BackToTheFuture102.exe") Then
            System.Diagnostics.Process.Start("Episode 2\BackToTheFuture102.exe")
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 2")
        End If
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If My.Computer.FileSystem.FileExists("Episode 3\BackToTheFuture103.exe") Then
            System.Diagnostics.Process.Start("Episode 3\BackToTheFuture103.exe")
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 3")
        End If
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        If My.Computer.FileSystem.FileExists("Episode 4\BackToTheFuture104.exe") Then
            System.Diagnostics.Process.Start("Episode 4\BackToTheFuture104.exe")
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 4")
        End If
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If My.Computer.FileSystem.FileExists("Episode 5\BackToTheFuture105.exe") Then
            System.Diagnostics.Process.Start("Episode 5\BackToTheFuture105.exe")
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 5")
        End If
    End Sub
End Class

Try this way ...

Code:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        If File.Exists(Application.StartupPath & "\inside episode 2\My_Install_II.exe") Then
            Dim _Exe As Process
            Dim My_exe As New ProcessStartInfo(Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "inside episode 2\My_Install_II.exe"))
            My_exe.WorkingDirectory = Application.StartupPath
            _Exe = Process.Start(My_exe)
            _Exe.WaitForExit()
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 2")
        End If

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        If My.Computer.FileSystem.FileExists(Application.StartupPath & "\inside episode 3\My_Install_III.exe") Then
            Process.Start(Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "inside episode 3\My_Install_III.exe"))
            Me.Close()
        Else
            MsgBox("File not found!!!", +vbExclamation, "Episode 3")
        End If

    End Sub
__________________
≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
« I Mediocri Imitano, I Geni Copiano, Dio Crea & Distrugge » (Io Ridefinisco & Perfeziono le Loro Opere Rendendole Uniche)
≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
« Mediocrities Imitate, Genius Copy, God Creates & Destroys » (I Reconsider & Improve Their Works, Rending Them One And Only)

Last edited by felice2011; 14-04-2017 at 09:31.
Reply With Quote
Sponsored Links