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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:55:57+00:00 2026-06-07T23:55:57+00:00

Scenario is: I have a button called X in project A One of the

  • 0

Scenario is:

  • I have a button called X in project A
  • One of the events for X is the following:

    private void X_KeyDown(object sender, KeyEventArgs e)
    {//if the user presses Ctrl + V 
        if (e.KeyCode == Keys.Control && e.KeyCode == Keys.V)
        {
          MessageBox.Show("hello");  
        }
    }
    
  • I’ve now created a new poject B and added a button to a form and also called it X. I then copied the above code into Form1.cs.

Question: If I go to form B and select the button and then double click the KeyDown event it does not go to the code I copied in but creates the following. Why ?

private void X_KeyDown_1(object sender, KeyEventArgs e)
{

}
  • 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-07T23:55:58+00:00Added an answer on June 7, 2026 at 11:55 pm

    Because you have neglected to copy the actual event binding, which is declared in your Form1.Designer.cs file. Something like

    X.Click += new System.KeyDownEventHandlerEtcEtc;
    

    Because this is missing, the studio thinks you’re trying to create a new event handler. But because the default name for that event handler it tacks on a _1.

    To overcome this, you can set the Click event in the designer manually to the specified, copied event handler. Or indeed any event handler with a matching signature.

    Another way to do this is to not copy the entire event handler, but only the logic – then create a new handler in your new Form, pasting the logic there.

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

Sidebar

Related Questions

I have the following scenario: in activity A, when a user clicks a button,
Here's the scenario I have a page lets say login.aspx having a button called
I have a scenario where the user can either click on the back button
I have a scenario where my UINavigationController is missing the back button (left button)
I have a scenario where I want to reduce the margin of a Button
Here is my scenario. I have the following line of code in my program:
Here's the scenario: I have a repeater inside an UpdatePanel called updPanel. Inside this
Here's the scenario I have an activity(A) which has a button and textview. I
I have a button in my activity, pressing upon which, the following method gets
Consider the following scenario: I have a page that can open a dialog (jquery

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.