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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:56:07+00:00 2026-06-17T21:56:07+00:00

Basically in a C# Windows Form Application I am working on I have 2

  • 0

Basically in a C# Windows Form Application I am working on I have 2 buttons I press button1 and button2.

How do I make it when I press 2 custom keys simultaneously(eg. CTRL+L) the program does the steps coded for button1? Keeping in mind that the window might not be active.

I have looked at this: Keypress To Simulate A Button Click in C# but I don’t think this would work if the window isn’t active, and its also only one button pressed not two.

  • 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-06-17T21:56:09+00:00Added an answer on June 17, 2026 at 9:56 pm

    In Form KeyUp Event and the Properties is KeyPressPreview = true you can achieve this task.

       private void Form_KeyUp(object sender, KeyEventArgs e)
       {
           if (e.KeyCode == Keys.L && e.Control)
           {
                    yourButton.PerformClick();
                    e.Handled = true;
            }
        }
    

    or

    if you want in Keypress Event

    private void Form_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.Control && e.KeyCode == Keys.L)
        {
                yourButton.PerformClick();
                e.Handled = true;
        }
    }
    

    EDIT:

    I realized that the OP want to the keypress Event from his statement “but I don’t think this would work if the window isn’t active”

    You probably must check this

    How to set a Windows hook in Visual C# .NET

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

Sidebar

Related Questions

Windows form application. C# 4.0. Basically I have two datagridviews dgv1 and dgv2. One
I have a windows form application that basically pings an ip and then returns
Currently I am working with: C# Windows forms application I currently have a problem
I have created a Windows Form application in C#. I designed interfaces with picture
Hi I have a windows form application. its has a database table with two
I have written a Silverlight application that is basically an account registration form. I
I have a Windows::Forms application and I want to add a custom control to
I am currently working on a Windows.Forms application. It's basically a simple motion detection
I have C# windows form application that queries data from a connected device. I
I am basically a windows developer and very new to Sharepoint. I have Designed

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.