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

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Marko Žnidar (marko.znidar_at_triera.net)
Date: 10/11/04


Date: Mon, 11 Oct 2004 09:04:39 +0200

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 ?

"iCeCLoW" <iCeCLoW@discussions.microsoft.com> je napisal v sporočilo
news:B126EBFA-E5D9-4929-9709-A638E9A22165@microsoft.com ...
> 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();



Relevant Pages

  • Re: why dataview.count become 0 when I double click on a datagrid?
    ... a datagrid has a dataview ... Initial filtering result would give the datavew 3 ... > get values out of a dataview that holds 0 items. ... with the current DataRowView. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: DataGrid bug?
    ... Next wrong assumption is what row indexes in the DataGrid would not change ... I DataGrid DataView DataTable ... row index to 3 which would generate an exception. ... If the selected cell has not been changed the code ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: DataView FilterExpresion Issue
    ... > filtering and sortering the data Ok. ... > instance, if I'm filtering my datagrid by 'Salesman A', when I change ... > longer in the dataview and that's not what I want. ... I *think* you could use a RowStateFilter of 38 ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: why dataview.count become 0 when I double click on a datagrid?
    ... forgot the datagrid was bind to the dataview and not the dataset. ... Initial filtering result would give the datavew 3 ... > with the current DataRowView. ...
    (microsoft.public.dotnet.languages.csharp)
  • Datagrid bug ?
    ... I have a strange problem. ... I have a Datagrid which is bound to a DataView. ... Sometimes an exception, which I can't catch, occurs. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)