Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2006

Tip: Looking for answers? Try searching our database.

Move focus between controls with Enter key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antoni Gomez - 27 Feb 2006 08:39 GMT
Hello, I want move the focus between controls with enter key, like (TAB).

Can you help me?

Thanks.

Antoni Gomez
vinu - 27 Feb 2006 09:16 GMT
HI,

Here is the step..

1. set winforms KeyPreview to True
2. On the key_down event add the following code..
   if (e.KeyValue == 13) SendKeys.Send("{Tab}");

Is this is what you wanted..??

Vinu

> Hello, I want move the focus between controls with enter key, like (TAB).
>
[quoted text clipped - 3 lines]
>
> Antoni Gomez
Michael Powell - 27 Feb 2006 14:01 GMT
Hi,
This is a bit of a cheat method,  and it will remove the possibility for
using the enter key, you should override ProcessCmdKey to process various
command keys as follows, to do this you must base your class on Control:

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
   if(keyData==(Keys.Enter))
   {
       //change the focus
   }
   return true;
}

Signature

Mike Powell
Ramuseco Limited
www.ramuseco.com

> HI,
>
[quoted text clipped - 15 lines]
>>
>> Antoni Gomez
Antoni Gomez - 27 Feb 2006 14:56 GMT
Thanks for your help.

The code works fine.

Antoni Gomez

> Hello, I want move the focus between controls with enter key, like (TAB).
>
[quoted text clipped - 3 lines]
>
> Antoni Gomez

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.