Results 1 to 5 of 5

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

  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.

  2. #2
    Junior Member
    Join Date
    May 2011
    Posts
    26

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

    I Have Visual Basic 2008 Express Edition the download is not The Same Virsion they say error when im click : External Apps.vbproj
    they say : this form made by newest version of Vb
    can you do one of my version
    and thank you so much

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

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

    @Dimitris4463 - a couple of things... in the future... do NOT include DLLs or EXEcutables in your zip files... secondly, next time, please include WHAT version of Visual Studio the project is for - VS2010 in this case.

    I've downgraded the sample app to VS2008 but it's untested and I will not support it...
    Attached Files Attached Files
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2010
    Posts
    38

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

    Quote Originally Posted by tonyjabbour View Post
    I Have Visual Basic 2008 Express Edition the download is not The Same Virsion they say error when im click : External Apps.vbproj
    they say : this form made by newest version of Vb
    can you do one of my version
    and thank you so much
    It have been long time since I removed VB2008 from my computer, so I can't do something about it. You can take a closer look at the code in the first post and do the same with the 2008 version.

    @techgnome
    Thanks for the info My first time in CodeBank

  5. #5
    Junior Member
    Join Date
    May 2011
    Posts
    26

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

    than you very much i appreciated that

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