c# - How to get the object name of a changed checkbox-item? -


i want .(name)-proterty of checkbox, has been changed?
need little example shown on messagebox.

form1

little snippet:

namespace checkboxes {     public partial class form1 : form     {         public form1()         {             initializecomponent();              this.chkcar.name = "chkcar";             this.chkcar.text = "chkcar";             this.chkhouse.name = "chkhouse";             this.chkhouse.text = "chkhouse";             this.chksea.name = "chksea";             this.chksea.text = "chksea";             this.chkwood.name = "chkwood";             this.chkwood.text = "chkwood";             this.chkcar.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged);             this.chkhouse.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged);             this.chksea.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged);             this.chkwood.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged);         }          private void generalcheckboxitem_checkedchanged(object sender, eventargs e)         {             messagebox.show(/*name of changed checkbox*/);         }     } } 

i think you're looking for:

checkbox c = sender checkbox; messagebox.show(c.name); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -