- Version
- Download 61
- File Size 103.86 KB
- File Count 1
- Create Date March 8, 2016
- Last Updated March 8, 2016
Open File Dialog in Visual Basic .Net
Open File Dialog in Visual Basic .Net
The OpenFileDialog component allows you to browse the folders of your computer and select one or many files.
This vb.net program will allow you to select a file on your computer and display the path, name of the file and file size on a textbox.
Source code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' OpenFileDialog1.ShowDialog()
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim getfilesize As System.IO.FileInfo
TextBox1.Text = OpenFileDialog1.FileName
TextBox2.Text = OpenFileDialog1.SafeFileName
'OpenFileDialog1.
getfilesize = My.Computer.FileSystem.GetFileInfo(TextBox1.Text)
TextBox3.Text = "File is " & getfilesize.Length & " bytes."
End If
End Sub
End Class