Sam

Sam

  • NA
  • 166
  • 0

How to get a control's (Button) Name

Jan 30 2010 1:42 AM

Hi all,
on C# Studio 2008 I have a form with several buttons that generate and write certain lists into listBoxes.
I need to know by the button Name to which listBox to write the info.

I find it very strange that in all the immediately available Button control information the Name does not show.
Niether of the 'object sender, EventArgs e' show this info (where I can get the button's Text which is insufficent as all my buttons have the same text)
When I ask for the Name of the control, it shows the name of the parent form (In this case, Form1) rather than the control Button.
The only way I find is by building a hashtable (or dictionary) with all Names, which seems too far to go.

Can anyone help me get this control name?

Do I miss somthing ?

Thanks
Sam

Attachment: HashTable.rar

Answers (3)