Advertisement
Guest User

vbcode

a guest
Apr 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. New: RichTextBox1.Clear()
  2.  
  3. =================================
  4.  
  5. Open:
  6.  
  7. Try
  8. Dim dlg As OpenFileDialog = New OpenFileDialog
  9. dlg.Title = "Open"
  10. dlg.Filter = "Rich Text Files (*.rtf)|*.rtf"
  11. If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
  12. RichTextBox1.LoadFile(dlg.FileName)
  13. End If
  14. Catch ex As Exception
  15. End Try
  16.  
  17. =================================
  18.  
  19. save:
  20.  
  21. Try
  22. Dim dlg As SaveFileDialog = New SaveFileDialog
  23. dlg.Title = "save"
  24. dlg.Filter = "Rich Text Files (*rtf)|*.rtf"
  25. If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
  26.  RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
  27.  End If
  28. Catch ex As Exception
  29.  End Try
  30.  
  31. ===============================
  32.  
  33. Undo: RichTextBox1.Undo()
  34.  
  35. Cut: RichTextBox1.Cut()
  36.  
  37. Copy: RichTextBox1.Copy()
  38.  
  39. Paste: RichTextBox1.Paste()
  40.  
  41. Select All: RichTextBox1.SelectAll()
  42.  
  43. =============================
  44.  
  45. Text Color:
  46.  
  47. Try
  48. Dim dlg As ColorDialog = New ColorDialog
  49.  dlg.Color = RichTextBox1.ForeColor
  50.  If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
  51. RichTextBox1.ForeColor = dlg.Color
  52.  End If
  53. Catch ex As Exception
  54. End Try
  55.  
  56. ==============================
  57.  
  58. Back Color:
  59.  
  60. Try
  61. Dim dlg As ColorDialog = New ColorDialog
  62. dlg.Color = RichTextBox1.BackColor
  63.  If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
  64.  RichTextBox1.BackColor = dlg.Color
  65.  End If
  66.  Catch ex As Exception
  67.  End Try
  68.  
  69. ========================
  70.  
  71. Font:
  72.  
  73. Try
  74.  Dim dlg As FontDialog = New FontDialog
  75.  dlg.Font = RichTextBox1.Font
  76. If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
  77.  RichTextBox1.Font = dlg.Font
  78.  End If
  79. Catch ex As Exception
  80. End Try
  81.  
  82. =============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement