anyone know the code for those using a rich textbox?
Printable View
anyone know the code for those using a rich textbox?
To use them, set the RichTextBox's AutoVerbMenu property to True.
yes but i have a menu with those options ... i want the code for them ...
Copy
Code:Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
Cut
Code:Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
Paste
Code:RichTextBox1.SelText = Clipboard.GetText()
Undo
Code:Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Const WM_UNDO = &H304
Private Sub Command1_Click()
SendMessage RichTextBox1.hwnd, WM_UNDO, 0, 0
End Sub
The RTB also has built in the shortcuts CTRL+(X, C, V, and Z) for this.
I noticed that if you use the Clipboard object in code to cut the selected text you can't undo that by pressing CTRL+Z.
What you can do is simply sending the right key combination to the RTB with the help of SendKeys.
Best regards
thanks matt ...
Joacim Andersson i first tried coding it that way ... i love sendkeys but one thing that makes me not use them is that for some reason it turns my NumLock light on and off ... don't know why but it just does ...
The following messages can also be sent
Code:Private Const WM_CUT = &H300
Private Const WM_COPY = &H301
Private Const WM_PASTE = &H302