Remember how I showed you the SaveFileDialog? Well you can use the OpenFileDialog in the exact same way with a couple minor tweaks:
vb.net Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Using ofd As New OpenFileDialog With {.AddExtension = True, _ .DefaultExt = "txt", _ .Filter = "Text File (*.txt)|*.txt|All Files (*.*)|*.*"} If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then Me.TextBox1.Lines = IO.File.ReadAllLines(ofd.FileName) End If End Using End Sub




Reply With Quote