You can assign the same event to multiple controls. When called the "object sender" portion will be a reference to whatever one of the controls was clicked.
The EventArgs portion is a way to pass extra information to the event handler. Some events use a derivative of EventArgs which contain extra information.
The function will be defined somethng like this (like any function thats auto generated for a form object):
private: System::Void MySpecialFunction_Click(System::Object^ sender, System::EventArgs^ e)
Enter the funciton name in the form objects click event property
In the function we can do this:-
if (sender == btnMyButton) //Was sender a specific control / object:
Or if we want to get at some property of the sender (for instance its state or its text field):
ToolStripMenuItem ^ClickedItem = dynamic_cast<toolstripmenuitem^>(sender);
if (ClickedItem != nullptr)
{
String ^MyString = ClickedItem->Text;
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.