Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enter Key blues in datagrid
Message
From
17/12/2010 00:47:06
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Miscellaneous
Thread ID:
01492264
Message ID:
01493028
Views:
49
>This Rocks :) :
>
>So it is the Tab key after all (the right key does not go to the next line at the end). And you need the OnKeyDownEvent for when you just "enter". It seems that ProcessDialogKey does not get fired then.


Hmmm ... the ProcessDialogKey *should* fire when you hit Enter ... if it doesn't for you, then something else is going on. Most likely you have your Form's KeyPreview property set to true and you're processing the Enter key at the Form level and not allowing it to get to the Control (your grid). You shouldn't need to use the OnKeyDown because the ProcessDialogKey *should* fire and should be all you need. You might want to read more about this (check out KeyPreview in the docs).

~~Bonnie



>
>
>    Protected Overloads Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
>        If keyData = Keys.Enter Then
>            Return Me.ProcessTabKey(keyData)
>        Else
>            Return MyBase.ProcessDialogKey(keyData)
>        End If
>    End Function
>
>    Protected Overloads Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
>        If e.KeyData = Keys.Enter Then
>            Me.ProcessTabKey(e.KeyData)
>        Else
>            MyBase.OnKeyDown(e)
>        End If
>    End Sub
>End Class
>
>
>
>
>>>Looks promising indeed.... Maybe there is something like "processTabKey"? which is really what I am after. And yes, I am subclassing datagridview :).
>>>
>>>Thanks dear.

>>
>>You're welcome! =0)
>>
>>I don't know why it's called ProcessRightKey() because it behaves like the TabKey ... so it's clearly what you're looking for.
>>
>>~~Bonnie
>>
>>
>>>
>>>>I have a better solution for you Marc, assuming that you're sub-classing the DataGridView and not the DataGrid (which is an older grid): use the ProcessRightkey() method:
>>>>
>>>>
>>>>    Protected Overloads Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
>>>>        If keyData = Keys.Enter Then
>>>>            Return Me.ProcessRightKey(keyData)
>>>>        Else
>>>>            Return MyBase.ProcessDialogKey(keyData)
>>>>        End If
>>>>    End Function
>>>>
>>>>
>>>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform