Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3681406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:41:08+00:00 2026-05-19T03:41:08+00:00

I just recently began in C# development, and I was working on a forms-based

  • 0

I just recently began in C# development, and I was working on a forms-based project and I am trying to perform a “tab” action when the user is on a form and pressed the Enter key.

I know the answer is probably quite simple, but I am a newbie in this realm.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:41:09+00:00Added an answer on May 19, 2026 at 3:41 am

    Welcome to SO Tex,

    I believe there are two methods to accomplish this, would just involve adding:

    Option 1: Grabbing the Next Control if an Enter KeyPress was performed

    In the properties of your form, set the KeyPreview property of the form to true.

    The code below will capture your “Enter-Press” event and perform the logic that you are looking for:

    private void [YourFormName]_KeyDown(object sender, KeyEventArgs e)
    {
        Control nextControl ;
        //Checks if the Enter Key was Pressed
        if (e.KeyCode == Keys.Enter) 
        {
            //If so, it gets the next control and applies the focus to it
            nextControl = GetNextControl(ActiveControl, !e.Shift);
            if (nextControl == null)
            {
                nextControl = GetNextControl(null, true);
            }
            nextControl.Focus();
            //Finally - it suppresses the Enter Key
            e.SuppressKeyPress = true;
        }
    } 
    

    This actually allows for the user to press “Shift+Enter” to go to the proceeding tab as well.

    Option 2: Using the SendKeys method

    private void [YourFormName]_KeyDown(object sender, KeyEventArgs e)
    {
      if (e.KeyCode == Keys.Enter)
      {
         SendKeys.Send("{TAB}");
      }
    }
    

    I am not sure if this method is still commonly used or may be considered a “hack”? I would recommend the first one, but I believe both should work for your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working at major companies for close to five years doing web development.
I've just recently learned C# and am interested in .net but I don't know
I'm using SQL Server 2008 and just recently started having an intermittent problem while
I have recently integrated in a HUD method into my XNA game project and
I am really new to php, I have recently developed a reliability simple web
We have several applications that use Apache HTTPClient 3 to make HTTP requests. Recently
I have recently begun to develop a game in Haxe which targets the Flash
I recently discovered some of the power and easy of use of dired mode
I recently asked this question regarding pulling beans out of an applicationContext. The answer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.