I have a datagrid bound to a strongly typed custom collection. I have
a Delete button on my form that calls the following code:
if ( this.BindingContext[myDataSource].Count > 0 )
{
myDataSource.RemoveAt( this.BindingContext[myDataSource].Position
);
}
I was expecting the button press to remove the elevant row from the
Datagrid, but I get an IndexOutOfRangeException saying No value at
index 2.
If I add the following below the RemoveAt call, everything works
correctly
this.dataGrid1.DataSource = null;
this.dataGrid1.DataSource = myDataSource;
I should not have to rebind my datagrid to my datasource. Can anyone
tell me what I have done wrong?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com