How to op-en file and view in a rich text box using vb.net?
- by Aaron Warnke
Hi I am trying to open and view a files text in a rich text box. Here is what I have please let me know what I am doing wrong?
Private Sub loadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadButton.Click
' Displays an OpenFileDialog so the user can select a Cursor.
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.Filter = "Cursor Files|*.txt"
openFileDialog1.Title = "Select a Cursor File"
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
' Assign the cursor in the Stream to the Form's Cursor property.
Me.mainRTBox = New Text(openFileDialog1.OpenFile())
End If
End Sub