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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:55:54+00:00 2026-05-26T05:55:54+00:00

I have a form that asks the user to press the Q key 3

  • 0

I have a form that asks the user to press the Q key 3 times. When he did so, the form shall disappear (which is why I use a borderless form to prevent hitting the X-Button). The form itself isn’t modal.

This is the code I use to handle the KeyDown event:

private void ConfirmForm_KeyDown_1(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Q)
    {
        if (++count == 3)
            this.Close();
    }
}

Now I don’t want to have an extra item for this form in the taskbar, so I set the ShowInTaskbar property to false. The problem is that the KeyDown event doesn’t get fired anymore when the form isn’t displayed in the taskbar – when it is, everthing works just fine.

Does anyone know how I can fix this bug?

  • 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-26T05:55:55+00:00Added an answer on May 26, 2026 at 5:55 am

    The KeyPreview property of the form must be set to True in order for the form to receive key events when there are other controls on the form that can receive focus.

    Edit: Also, if you want to prevent hitting the X button, you can set ControlBox to False, which hides the title bar buttons.

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

Sidebar

Related Questions

I have made a form that asks the user to put in first name
At http://localhost/tmp/ I have a form that asks for the user and password (authentication).
I have a form that accepts user input and asks them to upload a
I currently have form that checks if a user has unsubmitted changes when they
I have a form that contains a GridView control which is databound to an
We have a form that allows a user to filter a list with by
I have a form that asks users to input numbers into multiple form fields.
I have a php page that has a form that asks for an e-mail.
I have a form that asks users to enter a start and end time
I have an assignment that asks me to retrieve delimited text from form values.

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.