Jan 2, 2015 06:15 PM
(This post was last modified: Jan 2, 2015 06:34 PM by CodeBinary.)
Open up Visual Basic
Insert a textbox, and button
Double click your button:
Make a variable called ofd
What this is: Declaring a variable called ofd and makes new OpenFileDialog
Now call your variable and give it a title and filter it.
Now make an id statement that if the file was ok change the textbox's text to the file name.
Final Code:
Insert a textbox, and button
Double click your button:
Make a variable called ofd
Code
Dim ofd As New OpenFileDialogWhat this is: Declaring a variable called ofd and makes new OpenFileDialog
Now call your variable and give it a title and filter it.
Code
ofd.Title = "Select Your file!" : ofd.Filter = "(*.exe)|*.exe"Now make an id statement that if the file was ok change the textbox's text to the file name.
Code
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Text = ofd.FileName
End IfFinal Code:
Code
Private Sub ElegantThemeButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ElegantThemeButton2.Click
Dim ofd As New OpenFileDialog
ofd.Title = "Select Your file!" : ofd.Filter = "(*.exe)|*.exe"
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Text = ofd.FileName
End If
End Sub


