|
-
May 24th, 2010, 07:40 AM
#1
Thread Starter
Addicted Member
Problem with cell KeyDown event
I have this code in the onKeyDown event of the datagridview.
Code:
Private Sub DataGridView1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
Select Case e.KeyCode
Case Keys.Return
e.SuppressKeyPress = True
SendKeys.Send("{TAB}")
End Select
End Sub
This works. When the Enter button is pressed, it acts as the TAB button.
The problem I am having is this only works if the datagridviewer is selected.
As soon as I enter data into a cell (A cell is selected) the code wont work as it is not set for the cell keyDown event. The event does not exist, so I have to somehow create it.
Does anyone know how to do this?
-
May 24th, 2010, 07:22 PM
#2
Re: Problem with cell KeyDown event
 Originally Posted by tgf-47
I have this code in the onKeyDown event of the datagridview.
I'm a bit of a stickler for terminology so I will point out that there is no OnKeyDown event. There's an OnKeyDown method and a KeyDown event. Also, you can't have code in an event. The method that handles the event is not the event itself. So, to be precise, you have that code in the KeyDown event handler.
As for the question, I've already answered it in another thread of yours. Please don't create multiple threads for the same question.
http://www.vbforums.com/showthread.php?t=615909
-
May 25th, 2010, 05:25 AM
#3
Re: Problem with cell KeyDown event
Please do not post multiple threads for the same question.
This thread is now closed.
Tags for this Thread
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
|