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 369437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:55:10+00:00 2026-05-12T13:55:10+00:00

I want to register when the key Tab has been pressed, but can’t figure

  • 0

I want to register when the key “Tab” has been pressed, but can’t figure out how to use the ProcessDialogKey.

This is what i got:

this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Keypress);    

private void Keypress(object sender, KeyPressEventArgs e)
{
    MessageBox.Show("button: " + e.KeyChar);
}

This can only capture regular chars, but i also need other like “Tab” etc….

So i studied a bit, and found that many had used the ProcessDialogKey, but i’m abit uncertain how to use it.

here’s what i got:

protected  override bool ProcessDialogKey(Keys keyData)
{
    switch (keyData)
    {
        case Keys.Up:
            MessageBox.Show("Up");
            break;
        case Keys.Tab:
            MessageBox.Show("Tab");
            break;
        default:
            break;         
    }
}

I get the error: 'project.frm_test.ProcessDialogKey(System.Windows.Forms.Keys)': no suitable method found to override

What am i doing wrong?

And bear with me… i’m used to php 🙂
So i’m kinda new to c# 🙂

  • 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-12T13:55:11+00:00Added an answer on May 12, 2026 at 1:55 pm

    Your code is working, you message box is just displaying the tab character i.e. blank space.

    Cast to int and you will see it’s working:

    MessageBox.Show("button: " + (int) e.KeyChar); 
    

    EDIT:
    Otherwise look at this code:

    public Form1()
    {
        InitializeComponent();
    
        this.KeyPress += new KeyPressEventHandler(this.Form1_KeyPress);
        this.KeyDown += new KeyEventHandler(this.Form1_KeyDown);            
    }
    
    // Keypress only handles keys in the ascii range
    private void Form1_KeyPress(object sender, KeyPressEventArgs e) 
    { 
        MessageBox.Show("KeyPress: " + (int) e.KeyChar); 
    }
    
    // Keydown will work for all keys
    private void Form1_KeyDown(object sender, KeyEventArgs e)
    {
        MessageBox.Show("KeyDown: " + e.KeyCode); 
    }          
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a win32 COM dll. I want to register this dll for different
I want to make a WCF timer service where clients can register in order
I am working on a CustomControl and I want to register ModifierKeys in this
I want to register all my types implementing IManager so that they can be
I want to test this view: def register(request): handle user registration code variable is
I want to register a script with wordpress that will work on the backend.
I want to register for screen resolution changes on the Mac. I have a
I have created a COM Component in C++. Now i want to register my
NB: i´m using Twig in a non-Symfony context. I want to register a master
I have an animation running in the background, and I want to register a

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.