Groups | Blog | Home
all groups > vb.net > march 2006 >

vb.net : Invoking CTRL+C,X,V programatically



Ori :)
3/31/2006 9:10:02 PM
Hi Guys,

I need to be able to perform cop/cut/paste in any textbox of the application
i have focus on USING a button (not key combination). how can I invoke the
^C, ^X and ^V programatically?

I tried something like:
Private Sub btnPaste_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles
btnPaste.Click
System.Windows.Forms.SendKeys.Send("^(v)")
End Sub

-Didn't work

Any idea?

Thanks!
Jim Hughes
3/31/2006 9:25:13 PM
I wouldn't bother with keystrokes..

Instead look at the System.Windows.Forms.Clipboard class and it's methods.

[quoted text, click to view]

Herfried K. Wagner [MVP]
4/1/2006 8:53:11 PM
"Ori :)" <Ori@discussions.microsoft.com> schrieb:
[quoted text, click to view]

\\\
If TypeOf Me.ActiveControl Is TextBoxBase Then
DirectCast(Me.ActiveControl, TextBoxBase).Copy()
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
AddThis Social Bookmark Button