Re: Deleting rows in a DataView

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



Better make that:

Do While dview.Count > 0
dview.Delete(0)
Loop





"JohnGriffiths" <Reply@xxxxxxxxxxxxxxx> wrote in message
news:dj8tfi$irm$1@xxxxxxxxxxxxxxxxxxxxxxx
> Not an expert but I would expect something like
>
> Do While dview.Count > 0
> dview.Delete(1)
> Loop
>
> Regards John
>
> Or
>
> Set dview = Nothing
>
> :-)
>
>
> "Geoff" <nodamnspam@xxxxxxxxx> wrote in message
> news:VLidnQzwbZn_cMreRVnytQ@xxxxxxxxxxxx
>> Hi
>>
>> I'm hoping somebody can help me with the following.
>>
>> I'm trying to delete all the rows in a dataview. There are 200 rows.
>> Everything works fine until I delete half way through and then I'm told
>> in
>> an exception that
>>
>> "There is no row at position 100"
>>
>> The code I'm using is:
>>
>> For Each i As Integer In MyList
>> dview.Delete(i)
>> Next
>>
>> where MyList holds the numbers 0 to 199
>>
>> There are 200 rows in the dataview (I can see them in a datagrid).
>>
>> Can anybody tell me what I'm doing wrong?
>>
>> Geoff
>>
>>
>
>


.



Relevant Pages

  • Re: DataGrid bug?
    ... You can compare these in a loop to find our that's not the case even though you're not using filtering and sorting. ... Next wrong assumption is what row indexes in the DataGrid would not change while this loop is executed. ... I DataGrid DataView DataTable ... I get the exception only if I select a cell in the rightmost column of the DataGrid before I try to delete some rows. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: datarow and aggregate functions
    ... then applying a row filter to the dataview, i have 5 filters, day, week, ... I am also thinking about doing a loop through the dataview and adding up ... '1 is always the total value of apps, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Trying to re-sort a datatable
    ... Sorting of the DataView does not provide actual physical sorting of the ... What you need to do is to loop through the sorted ... > This causes the datagrid to sort the datarows correctly. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Sorting A DataTable
    ... Say you have your DataView: ... You can loop through like so: ... foreach (DataRowView dr in dv) ... DataView will iterate just like the DataTable ...
    (microsoft.public.dotnet.languages.csharp)
  • datarow and aggregate functions
    ... I am building a system that pulls a large dataset from the sql backend. ... then applying a row filter to the dataview, i have 5 filters, day, week, ... I am also thinking about doing a loop through the dataview and adding up the ...
    (microsoft.public.dotnet.framework.adonet)