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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:15:18+00:00 2026-06-17T10:15:18+00:00

Exactly where I must write this code? button1.MouseHover += Common_MouseHover; The problem is I

  • 0

Exactly where I must write this code?

button1.MouseHover += Common_MouseHover;

The problem is I want to declare one event handler and point each button at it. This is the common handler:

private void Common_MouseHover(object sender, EventArgs e)
{
     Button btn = sender as Button;
     if (btn != null)
         btn.Image = pic
}

But I dont know where i must write:

button1.MouseHover += Common_MouseHover;
utton2.MouseHover += Common_MouseHover;
.. etc

In designer? Where exactly?

  • 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-17T10:15:19+00:00Added an answer on June 17, 2026 at 10:15 am

    Either in the designer or the Constructor of your Form or if you are creating dynamic Buttons at the time of creation.

    public Form1()
    {
        InitializeComponent();
    
        button1.MouseHover += new EventHandler(Common_MouseHover);
        button2.MouseHover += new EventHandler(Common_MouseHover);
    
    }
    

    If in the Property Editor.

    enter image description here

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

Sidebar

Related Questions

I have this code for AES encryption, can some one verify that this code
Questions exactly like this have been asked before, i've read them all and tried
I know this isn't exactly how the pickle module was intended to be used,
I am using LaTeX to write a document about Python. This document will contain
i'm trying to write some dynamic code and i can't be sure the element
Sorry, I wasn't sure exactly what title to give this and have not been
I am trying to write code that will fetch the files in a directory
This is not exactly a question, it's rather a report on how I solved
This is a strange one. I'm running MVC 3 and have a custom action
I'm trying to write this win32 program with WinApi and I'm stuck because the

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.