Private Sub miOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miOpen.Click
With OFD
.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
.FilterIndex = 1
.Title = ""
End With
'show the open dialog and if the user clicks the open button, load the file
If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim alltext As String
Try
'save the file name
filename = OFD.FileName
'read the contents of the file
alltext = My.Computer.FileSystem.ReadAllText(filename)
'display the file contents in the testbox
tb.Text = alltext
Catch fileException As Exception
Throw fileException
End Try
End If
End Sub