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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:42:57+00:00 2026-06-04T22:42:57+00:00

I have my app with my labels written to centralize when its text was

  • 0

I have my app with my labels written to centralize when its text was modified.

To make that I invoke a method through an EventHandler. I want to use same method to each one of my labels, but I don´t know how to identify in the method which label invoke it.

If I have a code like this:

       lbl_TextChanged(object sender, EventArgs e)
        {
           ..code..
           label1.Location = new Point("label's location");
           ..more code..
        }

and I invoke again that method from another label, how could I modify that code in order to know which label invoke it?

SOLUTION Thanks for the help, This is the first time I tried to make something with the event handler and didn’t know that I need to cast the sender. That solves my problem.

Thanks for the help!

  • 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-04T22:42:59+00:00Added an answer on June 4, 2026 at 10:42 pm

    The sender object in the event handler signature is the control that raised the event.

    Simply cast this object and you have access to all the control’s information.

    Label label = sender as Label;
    

    You do need to be a little bit careful with this, since you are assuming that only controls of type Label are raising events that have this handler method.

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

Sidebar

Related Questions

I have a few labels on my first Ipad App. How to make them
I have app in which i have recorded sound files i want that i
I have an intranet app that needs to know where to print some labels.
I have a Windows Form app written in C#. Its job is to send
I have a Form that gets the name of one of its Labels from
I have an Android app with 3 tabs in a TabHost (text labels, no
In my app I have 4 labels and I need to add them immediately
In my app i have created one custom class for Label.Now i want to
In my iPhone app, I have a multiline label that I would like to
I have an app written in C# for the compact framework (3.5). I am

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.