A set of .NET Framework managed libraries for developing graphical user interfaces.
Hi @Rajkumar Rao , Welcome to Microsoft Q&A,
In the same way you can add events to them.
But the customized datagridview events are different in the desgin stage.
You can add the same events as ordinary datagridiview directly after creation.
The sample code is as follows:
public static class DataGridViewExtensions
{
public static void SetCommonEvents(this DataGridView sender)
{
sender.CellClick += CellClickEventHandler;
sender.EditingControlShowing += EditingControlShowing;
}
public static void CellClickEventHandler(object sender, DataGridViewCellEventArgs e)
{
}
public static void EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
}
}
Then manually use dataGridView1.SetCommonEvents(); for each one
Or foreach all datagridview added.
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.