Is there any way to return the name of the control I click on in a window form application using C#?
Using this pointer only returns form name.

Recommended Answers

All 2 Replies

The click event has a sender object, use it to obtain the name. You'll have to attach to the click event of the controls.

ohk! Now i think I might have asked it wrong..
see the scenario is smthng like this..
I have 10 checkboxes in a form... and what i want is when i right click on a checkbox and click edit on the contextmenu then the text value of the checkbox should change..
so what i want is to target the checkbox and that check box out of 10 on whihc i have right clicked..
where as sender object will return "Edit" as we are clicking on the Edit on the context menu.. got it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.