BASESLydia
asked on
How can you create a Windows.Forms.Keys that represents Ctrl + V being pressed?
It says in the VS.NET documentation that you can use the bitwiseor to combine enumerated key values to create a key that represents the control key modifier and the V key. I have tried all sorts of ways to do this and I can't get it to work!
Dim kyCtrlV As Windows.Forms.Keys
kyCtrlV = Keys.V | Keys.Control - doesn't work
basically i am trying to call a ss_Data_KeyUp method that takes a System.Windows.Forms.KeyEv entArgs parameter and I want to set the System.Windows.Forms.KeyEv entArgs key to by Ctrl V so I can imitate the user pasting data.
Dim kyCtrlV As Windows.Forms.Keys
kyCtrlV = Keys.V | Keys.Control - doesn't work
basically i am trying to call a ss_Data_KeyUp method that takes a System.Windows.Forms.KeyEv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In that way you create a KeyEventArgs that has the control set to True and the keyCode of V
I hope this could help you :)
I hope this could help you :)
SendKeys.Send("^{V}")
Bob
Bob
ASKER
r = New KeyEventArgs(r.Modifiers.C ontrol Or Keys.V)
That did it! Thank you so much.
That did it! Thank you so much.
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Messa
Const WM_KEYDOWN As Integer = &H100
Const WM_SYSKEYDOWN As Integer = &H104
Dim e As System.EventArgs
If ((msg.Msg = WM_KEYDOWN) Or (msg.Msg = WM_SYSKEYDOWN)) Then
Select Case (keyData)
Case Keys.ControlKey.V
'Do something
End Select
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function