Re: Remove Row from a DataView

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



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

.



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. ... Perhaps an easier option is to set a RowFilter against the view? ...
    (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: removing a loop cause it to go at half the speed?
    ... I tested it I found that removing the loop that initialises the data array for the operation caused the whole program to spend twice the time to complete. ... Without the initialisation, 1/4 of the array-accesses will result in a cache miss, and the processor will have to wait for the bus to grab the data from RAM. ...
    (comp.unix.programmer)
  • Re: LabVIEW FPGA/NI 9505 current sense returning incorrect values
    ... After I posted my message, I found that removing the Serial Number, ... and Vendor ID properties from the lower right hand while ... loop fixed the problem ... one was causing the problem, but it seems that keeping those properties ...
    (comp.lang.labview)