CheckedListBox displaying duplicated items(V2.0)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a CheckedListBox, I add an item with .Items.Add() and get two entries
displayed. If I try to select the second one I get a null reference error.

(It's sorted, but unsorted has the same problem.)

Am I doing something wrong?

..net 2.0, WinXP Pro
 
OK, I have a work-around. But first some more information...

I'm populating this CheckedListBox in it's Layout method.
First I Clear the Items then I populate it.

If I only populate when .Items.Count==0 I don't see the problem. But that's
not exactly what I want.

So to restate the situation...

I have a CheckedListBox on a TabPage that I want to populate fresh when the
TabPage becomes Selected, the Layout method of the CLB is apparently not the
place to do that, but no events for the TabPage seem to be the place, nor
does the Selected method of the TabControl.

I'm thinking the best solution is to derive a custom TabPage for each page,
add a Selected method to each, and have the TabControl's Selected method call
that, whaddaya think?
 
Back
Top