Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. Private Sub loadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadButton.Click
  2.  
  3. ' Displays an OpenFileDialog so the user can select a Cursor.
  4. Dim openFileDialog1 As New OpenFileDialog()
  5. openFileDialog1.Filter = "Cursor Files|*.txt"
  6. openFileDialog1.Title = "Select a Cursor File"
  7.  
  8. If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
  9. ' Assign the cursor in the Stream to the Form's Cursor property.
  10. Me.mainRTBox = New Text(openFileDialog1.OpenFile())
  11. End If
  12.  
  13. End Sub
  14.  
  15. Public Class Form1
  16.  
  17. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  18. ' Displays an OpenFileDialog so the user can select a Cursor.
  19. Dim openFileDialog1 As New OpenFileDialog()
  20. openFileDialog1.Filter = "Cursor Files|*.cur"
  21. openFileDialog1.Title = "Select a Cursor File"
  22.  
  23. If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
  24. ' Assign the cursor in the Stream to the Form's Cursor property.
  25.  
  26. Dim extension = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("."))
  27.  
  28. If extension Is "cur" Then
  29. Me.mainRTBox.Text = FileIO.FileSystem.ReadAllText(openFileDialog1.FileName)
  30. End If
  31.  
  32. End If
  33. End Sub
  34. End Class
  35.  
  36. RichTextBox1.LoadFile("YOUR DIRECTORY", RichTextBoxStreamType.RichText)
  37.  
  38. RichTextBox1.LoadFile("YOUR DIRECTORY", RichTextBoxStreamType.PlainText)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement