Results 1 to 5 of 5

Thread: VB.Net - Run external files (ex: .exe)

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2010
    Posts
    38

    VB.Net - Run external files (ex: .exe)

    Note: This example is for VS2010, it may work in 2008 but I can't support it.

    This is a small example application to show you how to use My.Seetings in vb.net in order to run an external application.

    Code:
    Code:
    Public Class Form1
        Dim strFileName As String
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            OpenFileDialog1.InitialDirectory = "C:\"
            OpenFileDialog1.Title = "Open an .exe File"
            OpenFileDialog1.Filter = "Executable Files|*.exe"
            OpenFileDialog1.ShowDialog()
            strFileName = OpenFileDialog1.FileName
        End Sub
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            My.Settings.path = strFileName
            TextBox1.Text = My.Settings.path
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If My.Settings.path = "" Then
                MsgBox("Not selected path!")
            Else
                Process.Start(My.Settings.path)
            End If
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TextBox1.Text = My.Settings.path
        End Sub
    
        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            My.Settings.path = ""
            TextBox1.Text = ""
        End Sub
    End Class
    If you find it useful rate me or say thanks, it gives me a reason to continue.
    Attached Files Attached Files
    Last edited by Dimitris4463; May 27th, 2011 at 09:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width