Re: Remove Row from a DataView

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Jun 7, 2:26 pm, Marc Gravell <marc.grav...@xxxxxxxxx> wrote:
but this does not seem to work

So what *does* happen? Does the count change?

First - you need to be very careful removing from a loop you are
iterating - the code you have is susceptible to cumulative "off by
one" errors every time it deletes - so with 2 adjacent youngsters only
the 1st would disappear. Perhaps iterate backwards instead? (or see
below).

There is no guarantee that the order is the same in the view and the
table (if a sort is set on the view), so if the wrong rows are
disappearing perhaps you should be removing from the view (which will
talk to the table).

Perhaps an easier option is to set a RowFilter against the view? that
way they simply don't appear, as opposed to removing them from the
system just because they can't buy beer (or whatever).

Marc

Hi Marc, thanks. I did think that I was getting off by one errors;

I will just use rowfilter

Thanks for your help
Markus

.



Relevant Pages

  • Re: altering an object as you iterate over it?
    ... One solution I tried is to open the file and use readlines(), ... you are iterating with it. ... removing the first shortens the list by one, ... for i in range(numEmptyLines): ...
    (comp.lang.python)
  • Re: Remove Row from a DataView
    ... First - you need to be very careful removing from a loop you are ... iterating - the code you have is susceptible to cumulative "off by ... the 1st would disappear. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Finding maximum of an array
    ... every time looking at the maximum value and then removing the ... It means iterating over the entire large ... XanaNews Version 1.17.5.7 [Q's Salutation mod] ...
    (borland.public.delphi.language.basm)
  • Re: XP SP3 doesnt remove all those $NtUninstallKB folders??
    ... c:\windows\$NtUninstallKB* folders would disappear. ... I want to upgrade my XP Home to SP3, but not if it won't be removing ...
    (microsoft.public.windowsxp.general)