How to get button name when i add it programically
hello, how can i get button name on click when i add for example 5 buttons with for cycle via panel.Controls.Add(button) for example. Thamks
On the click event you can cast the sender to button and read the name property.
Try this:
1 2 3 4 5 6
|
System::Void button1_Click (System::Object^ sender, System::EventArgs^ e)
{
Button^ btn = dynamic_cast<Button^>(sender);
MessageBox::Show (btn->Name);
}
|
oh thanks, i still mean i can use sender->Name or something else, thanks a lot :)
Topic archived. No new replies allowed.