Mega Code Archive

 
Categories / VB.Net Tutorial / GUI
 

Set OpenFileDialog Filter and get selected file name

Imports System.Windows.Forms public class FileOpenDialogFilter    public Shared Sub Main         Dim openFileDialog1 As System.Windows.Forms.OpenFileDialog         openFileDialog1 = New System.Windows.Forms.OpenFileDialog()                  openFileDialog1.Filter = "Word (*.doc) |*.doc;*.rtf|(*.txt) |*.txt|(*.*) |*.*"         If openFileDialog1.ShowDialog() = DialogResult.OK Then             Console.WriteLine(openFileDialog1.FileName)         End If    End Sub End class