datagrid IndexOutOfRangeException

datagrid IndexOutOfRangeException

Post by RGlhbm » Wed, 21 Sep 2005 02:40:02


I got two datagrids the first is to display what has been retrived by a
selectcommand from a dataset. The other dataset is to display data that is
"bound" to the selected row in datagrid1.
im filling datagrid1 and it works fine, when i select some row from
datagrid1 the datagrid2 is filling fine too, but when i edit a cell from
dataset2 and cancel the operation and cursor is on some cell, i get the next
error:

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
at
System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager
source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Edit(CurrencyManager
source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String instantText,
Boolean cellIsVisible)
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()