المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : parameter in Event Handler



C# Programming
09-01-2009, 01:22 PM
Hello,,

Is it possible to send a parameter like below?


CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentChild.ID;
oCheckBox.Click += new RoutedEventHandler(this.CheckClick);

Now I want to send the name of check box to the event handler. HOw can I do it?

Like


CheckBox oCheckBox = new CheckBox();
oCheckBox.Name = "cb_" + currentChild.ID;
oCheckBox.Click += new RoutedEventHandler(this.CheckClick,oCheckBox.Name);


so that in CheckClick(object sender, RoutedEventArgs e) I can get the name of that check box as there will be many dynamically created check box.