luni, 25 august 2014

Add dynamic event to controls (C#)

When you create a CancelEventHandler delegate, you identify the method that will handle the event. 
To associate the event with your event handler, add an instance of the delegate to the event. 


txtReportHeader.Validating += new CancelEventHandler(MyValidating);
private void MyValidating(object sender, CancelEventArgs e)
{
     // some validation
}

Niciun comentariu:

Trimiteți un comentariu