DataView RowFilter: Index was outside the bounds of the array.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,
I´m using the rowFilter property for filtering the rows in a DataView
object. If the filter is set to an inexistent value , that is, after
filtering i have 0 rows in the DataView, and I try to re-show all the rows
again by setting rowFilter = "", after setting the rowStateFilter i obtain
the "Index was outside the bounds of the array",.
If the dataview is not empty this code works fine. Here is the code:

currentView.RowFilter = stringFilter;

currentView.RowStateFilter = System.Data.DataViewRowState.CurrentRows;

if (currentView.Count == 0)
{
currentView.RowFilter = "";

}

Application.DoEvents();
 
Hey there.
I dont know why this happens i get the same exception in datagrid in my code
i added :
i = customDataGrid1.CurrentRowIndex;

if (i==-1)
return; // skip the exception

Did u notice when u set your datagrid cells to read-only this does not
happen ?
 
Back
Top