I'm making an ordinary program, it consists of many controls such as Webbrowser, Text Box, Rich Text Box, etc.. I have a menu that has Cut/Copy/Paste in it. I want those to work just as they would in any other program... How do I do that??
Printable View
I'm making an ordinary program, it consists of many controls such as Webbrowser, Text Box, Rich Text Box, etc.. I have a menu that has Cut/Copy/Paste in it. I want those to work just as they would in any other program... How do I do that??
Code:'paste into a textbox
Text1 = Clipboard.Gettext
'get text from a textbox
Clipboard.Settext Text1.text
'copy a variable content to clipboard
Clipboard.Settext MyVar
'clear the clipboard
Clipboard.Clear
that will only work if you are using a textbox called text1! I want it to work for all controls!
You could use the ActiveControl property of the form to find out the control that the caret is currently in.
eg:Code:Dim ctl as Control
Set ctl = Me.ActiveControl
If TypeOf ctl Is TextBox Or TypeOf ctl Is RichTextBox Then
Clipboard.SetText ctl.SelText
ElseIf TypeOf ctl Is WebBrowser Then
' I have not used this control before, so ask for others help
End If
any1 else??
It seems to me that AhBeng has the right idea....But Isn't there an easier way of doing his method...BUT, I'll have over 50 lines of code just for the "Copy Feature" because I have lots of controls on my form!!!