Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enter Key blues in datagrid
Message
De
17/12/2010 00:47:06
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
VB 8.0
OS:
Vista
Network:
Windows XP
Database:
Jet/Access Engine
Application:
Desktop
Divers
Thread ID:
01492264
Message ID:
01493028
Vues:
51
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform