"Peter Duniho" <(E-Mail Removed)> wrote in message
news:W-(E-Mail Removed)...
> On 1/18/11 8:15 PM, mp wrote:
>> [...]
> Either can work, and it's not a huge deal to do it in ItemCheck rather
> than ItemChecked (especially if you know that items are only ever added in
> the unchecked state, and always ever will be).
in this case that is true(new items are not added after initial load), but
good to know for future
But you should not
> worry too much about repeating all that logic every time an item is added
> to the list. It isn't going to be any kind of performance bottleneck, and
> again if the code is simpler that way, that's the better choice.
>
> Pete
when i started playing with the event to see how and when it worked
and why my assumption about .CurrentValue wasn't working, i had a message
box
that's how i found out about it firing as it was loading...
of course i got rid of the msgbox once i figured out CurVal was opposite
what i thought.
so, that's right, it wouldn't matter in reality that the event was firing
before i really had to start watching the event...
I didn't know off the top of
my head how to tell the difference between the event as control was loading
versus the event when user was interacting, so i just went with the event
that
only fired on user interaction. I probably could set some bool var when the
loading starts
and reset it once it's done loading, then check that in the event to see
whether to fire,
but if i didn't do that(bool var), a new item is added, (obviously in an
unchecked state), the event tries
to remove from dictionary, but it's not in dictionary yet, so wouldn't that
throw an error?
i'll try later, maybe remove doesn't error on nonexistant key, maybe it just
ignores it?
and of course i can just add back the error check but as you said, it's
cleaner without it.
thanks for that
mark
|