|
-
Nov 4th, 2002, 04:54 PM
#1
Thread Starter
New Member
CTRL + C keypress on a Datagrid
Hi,
I wish to capture the keypress event for a datagrid. I have added the handlers for the Keypress and Keydown for the textbox of each column. Problem is that the modular keys (Control, shift and ATL) are handled by the keydown and the 'C' key is handled by the keypress. How can i get the combination code for this so that i can write my copy routine.
Thanks in advance.
-
Nov 4th, 2002, 11:17 PM
#2
Frenzied Member
Try this in the _KeyDown event
VB Code:
'This shows you how to trap when certain keys are pressed
If e.KeyCode.Equals(Keys.Enter) = True Then
lblPressed.Text = "you pressed: Enter"
ElseIf e.KeyCode.Equals(Keys.F10) = True Then
lblPressed.Text = "you pressed: F10"
Else
lblPressed.Text = e.KeyCode.ToString
End If
~Peter

-
Nov 5th, 2002, 10:30 PM
#3
-
Nov 5th, 2002, 10:42 PM
#4
PowerPoster
Here's one way that investiages which bits are set in the modiferkeys property of the control object:
Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If (Control.ModifierKeys And Keys.Shift) > 0 And (Control.ModifierKeys And Keys.Control) > 0 Then
If e.KeyCode = Keys.A Then
MessageBox.Show("Shift + Control + A")
End If
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|