Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make [EnterKey] navigate to next column
Message
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Divers
Thread ID:
00862240
Message ID:
00862397
Vues:
16
This message has been marked as the solution to the initial question of the thread.
One way you can move to the next column when the user presses Enter is to subclass your DataGrid and override its ProcessKeyPreview method checking for the Enter key and swapping it for the Tab key.
Const WM_KEYDOWN As Integer = &H100

Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
     Dim keyCode As Keys = CType(m.WParam.ToInt32(), Keys) And Keys.KeyCode

     If m.Msg = WM_KEYDOWN And keyCode = Keys.Enter Then
          m.WParam = New IntPtr(Keys.Tab)
     End If
     
     Return MyBase.ProcessKeyPreview(m)
End Function 'ProcessKeyPreview
>Hi to all!!
>
>I have to admit that it has been very tough for me to migrate my skills from VB6 to Vb.Net, the concepts are about 100% different, and as there are some easier ways to do things there also are harder ways to other.
>
>well,
>
>The issue is:
>
>I've noticed that when I press the enter key on a grid bounded to a datatable it navigates to the next row and it doesn't raises no event to the datagrid, not even a TextBox declared withevents for controling a datagrid column.
>
>The question is:
>
>How can I validate the enter key on a Datagrid to have it navigate to the right and when it's in the last column then navigate down/back just like a carrier return.
>
>I'll appreciate your help, thanks in advance.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform