Sammy,
What you want to do is capture the KeyDown event. In it, you can detect
which key is pressed. Once you do that, call the GetNextControl method on
the control that has the focus, specifying itself as the start point. It
will return a Control instance which represents the next control that the
tab focus would shift to. At that point, call the Focus method on the
control.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Sammy" <sa***@spam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi,
I want to make the enter key function like the tab key in WinForms. I
used to do it in VB6 using the code below:
If KeyAscii = 13 Then ' The ENTER key.
SendKeys "{tab}" ' Set the focus to the next control.
KeyAscii = 0 ' Ignore this key.
End If
I understand how to use the SendKeys class in .Net however not how to test
for the enter key. Also I am wondering if there is a better way to do
this in .Net.
SendKeys.Send("{Tab}");
Thanks