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

  • Home
  • SEARCH
  • 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 6623523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:32:33+00:00 2026-05-25T21:32:33+00:00

I am hoping for some help. In my application, I have a Text Box

  • 0

I am hoping for some help.

In my application, I have a Text Box which should display the event occured in any control while clicking it.

For exmaple, if I click on a button or a checkbox in the app., the text box should identify the event and display as button1.clicked, checkbox1.checked kind of things.

Can anyone help me to get this done.

Thanks In Advance.:)

  • 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-25T21:32:34+00:00Added an answer on May 25, 2026 at 9:32 pm

    If you want to do it for all controls dynamically you can navigate through the controls tree and subscribe the same event handler for events like shown below, in case of predefined controls set basically just subscribe all of them for the same even handlers.

    Predefined controls set

    checkBox1.CheckedChanged += (s, e) => { /*  handles Checked state changes*/ };
    button1.Click += (s, e) => { /*  handles button click */ };
    

    Dynamic

    private void InitializeHooks()
    {
        foreach(var control in this.Controls)
        {
           var button = control as Button;
           if (button != null)
           {
              button.Click += OnClick;
              continue;
           }
    
           var checkBox = control as CheckBox;
           if (checkBox != null)
           {
              checkBox.CheckedChanged += OnCheckedChanged;
           }       
        }
    }
    
    // Button click handler
    private void OnClick(object sender, EventArgs eventArgs)
    {
       txtOutput.Text = String.Format(
                                    CultureInfo.CurrentCulture,
                                    "{Control Type: {0}, Name: {1}, Event: Click",
                                    sender.GetType().Name,
                                    sender.Id);
    }
    
    // Checkbox Checked state changed handler
    private void OnCheckedChanged(object sender, EventArgs eventArgs)
    {
         txtOutput.Text = String.Format(
                                    CultureInfo.CurrentCulture,
                                    "{Control Type: {0}, Name: {1}, Event: CheckedChanged",
                                    sender.GetType().Name,
                                    sender.Id);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem that I am hoping to get some help with.
I'm hoping people have some ideas to help solve this problem. I am developing
I have an issue I'm hoping someone can help with. I have an application
I came across some magic today and I am hoping for some help in
I am having troubles with jQuery's load function and am hoping for some help.
I am hoping to get some help on this issue. Some users on IE
I have a web application which will return a user id based on the
I am hoping to obtain some some help with 2D object detection. I'll give
I have an application which I developed about a year ago and I'm fetching
While learning to crawl with DI tools, I am hoping someone can help me

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.