Click here to Skip to main content
12,067,916 members (31,045 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Windows Forms
Hi all,
I have different types of controls in my windows form,when i press enter key it should act as tab..

i have written function like
private void keypressevents(KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                SendKeys.Send("{TAB}");
            }
            
        }

and called "keypressevents(e)" in form's keypress event.

but the result is negative...plz help me..
Posted 1-Jul-13 20:58pm
Edited 1-Jul-13 21:38pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Assuming, that you tagged you your question deliberately with asp.net, and you write windows forms by mistake:
You can't handle this on server side.
You have to do it on client side with JavaScript. Read these:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=538[^]
http://paulwerickson.com/jquery-how-to-tab-with-the-enter-key/[^]

Assuming, that you tagged you your question by mistake with asp.net, and you write windows forms deliberately:
Look here: Redirect the Enter key from a Windows Forms TextBox[^]
  Permalink  
v2
Comments
Member 10050742 2-Jul-13 2:23am
   
sorry i have mistaken,actually it's a windows application not asp.net

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160208.1 | Last Updated 2 Jul 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100