I am trying to find the event (if there is one) which occurs when a row
is added to the DataGridView.
The closest I can find is the RowsAdded event which says in documentation:
Occurs after a new row is added to the System.Windows.Forms.DataGridView.
OK then so I debug my code. I am adding 11 rows with a datasource and I
get 4 occurences of the RowsAdded:
?e
{System.Windows.Forms.DataGridViewRowsAddedEventAr gs}
Empty: {System.EventArgs}
RowCount: 1
RowIndex: 0
{System.Windows.Forms.DataGridViewRowsAddedEventAr gs}
Empty: {System.EventArgs}
RowCount: 11
RowIndex: 1
{System.Windows.Forms.DataGridViewRowsAddedEventAr gs}
Empty: {System.EventArgs}
RowCount: 1
RowIndex: 0
{System.Windows.Forms.DataGridViewRowsAddedEventAr gs}
Empty: {System.EventArgs}
RowCount: 11
RowIndex: 1
The call stack shows the same line:
Me.SongInfoBindingSource.DataSource = newSource
for each event occurrence and the above line is executed only once.
This is somewhat confusing as it does not do as the documentation says
and even so why is it doing the event four times and why oh why can the
DataGridView not have events like in ASP.NET so that on each addition of
a row it will give you an event so that you can do whatever is needed at
that time?????
Lloyd Sheen