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.
Last edited by Dimitris4463; May 27th, 2011 at 09:59 AM.
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
@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...
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