Using safe_cast to access the object that triggered an event

An example using a single event triggered by multiple combo boxes


	//Setting up combo boxes
	MyComboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &frmMain::GeneralComboBox_SelectedIndexChanged);
	MyComboBox1->Tag = 1;		//In this example we use the tag property to store an ID we will use later
	MyComboBox2->SelectedIndexChanged += gcnew System::EventHandler(this, &frmMain::GeneralComboBox_SelectedIndexChanged);
	MyComboBox2->Tag = 2;
	MyComboBox3->SelectedIndexChanged += gcnew System::EventHandler(this, &frmMain::GeneralComboBox_SelectedIndexChanged);
	MyComboBox3->Tag = 3;

 (more...)