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 recently began working with Threads and I am trying to complete a Java
I've recently began using dTrace and have noticed just how awesome it is. Its
Just recently I dove into the VideoLAN open source project. This was my first
I just recently began using synthesized instance variables in my iPhone projects. The problem
So working on a project recently (by myself - no other developers), I somehow
I recently diverged from business application programming to trying my hand (just as a
Currently I'm still using Xcode 3 for iPhone development and I've just recently pulled
I have just began recently to learn Haskell, more specifically on the topics of
I recently began developing a little javascript game, just for fun. The idea was
Recently i started a project with so many forms , frames and extra controls,

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.