Imports System.Windows.Forms
public class OpenFileDialogWith
public Shared Sub Main
Dim OpenFileDialog1 As OpenFileDialog = New System.Windows.Forms.OpenFileDialog
With OpenFileDialog1
.FileName = "C:\My Documents\Doc1.txt"
.DefaultExt = ".txt"
.Filter = "Text Files|*.TXT"
.Filter = "Bitmaps|*.BMP|GIF Images|*.GIF|" & _
"JPG Images|*.JPG|All Images|*.BMP;*.GIF;*.JPG"
.FilterIndex = 2
.InitialDirectory = "C:\My Documents"
.ShowReadOnly = True
.ReadOnlyChecked = True
End With
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
Console.WriteLine(OpenFileDialog1.FileName)
End If
End Sub
End class
|