How do I add the event?
On default after adding the datagrid to the form, it didnt have the rowsadded event.
Then I added this in
private void dataGridView1_RowsAdded(object sender, DataGridViewCellEventArgs e)
{
MessageBox.Show("Row added", "Error!");
}
Which was able to run, and when I was adding data to the grid, this didn’t trigger. Am I missing a step?
From Code Behind
after
InitializeComponent();add
event should change as
KB Shortcut
From designer
You can do this from designer view. go to properties of the grid view and select events tab. find RowsAdded event and double click on it. it will generate event handler and event for you.
Microsoft Visual Studio and C#: How to Visually Add Events to Controls?