spidervenom
Programmer
Hi all,
This maybe a little bit hard to explain (and confusing), but hope someone can help.
I have 2 ComboBox (Cmb1, Cmb2). They are bounded to DataSource. There are 2 items in Cmb1, and Cmb2 populates its items based on Cmb1 SelectIndexChanged event.
If Cmb1 item 1 is selected, 2 items will populate in Cmb2. If Cmb1 item 2 is selected, 3 items will populate in Cmb2.
Here is the scenario that I have problem with:
1. After selecting Cmb1 item 2, then select the 3rd item in Cmb2
2. Then go back and select Cmb1 item 1, Cmb2 will display blank since there is no 3rd item for Cmb1 item 1. When I select an item from it, it will generate IndexOutOfBound error.
It seems that after selecting the 3rd item of Cmb1 item 2, the pointer does not get reset for Cmb1 item 1.
However, if I made both to have the same number of items (each has 3 items) in Cmb2, then I don't have problem.
Is there a way that I can the make Cmb2 points to the first item everytime I switch between items in Cmb1? Or is it a bug of ComboBox?
This is urgent. Any help is greatly appreciated.
Thanks a lot!!!
This maybe a little bit hard to explain (and confusing), but hope someone can help.
I have 2 ComboBox (Cmb1, Cmb2). They are bounded to DataSource. There are 2 items in Cmb1, and Cmb2 populates its items based on Cmb1 SelectIndexChanged event.
If Cmb1 item 1 is selected, 2 items will populate in Cmb2. If Cmb1 item 2 is selected, 3 items will populate in Cmb2.
Here is the scenario that I have problem with:
1. After selecting Cmb1 item 2, then select the 3rd item in Cmb2
2. Then go back and select Cmb1 item 1, Cmb2 will display blank since there is no 3rd item for Cmb1 item 1. When I select an item from it, it will generate IndexOutOfBound error.
It seems that after selecting the 3rd item of Cmb1 item 2, the pointer does not get reset for Cmb1 item 1.
However, if I made both to have the same number of items (each has 3 items) in Cmb2, then I don't have problem.
Is there a way that I can the make Cmb2 points to the first item everytime I switch between items in Cmb1? Or is it a bug of ComboBox?
This is urgent. Any help is greatly appreciated.
Thanks a lot!!!