Clearing combo box value

mozaharul

Active Member
Licensed User
I have added 2 combo boxes in a form. 2nd combo box shows a range of values say 1 to 10 when a value (1) in 1st combox is choosen, similarly it shows another range of values say 11 to 20 when another value (2) in 1st combo box is clicked. this is ok. For 1 in 1st combo box 10 was choosen in the 2nd combo box but when 2 is choose in the 1st cmobo box the 2nd combo box still shows 10, I want it should be blank.since for 2 in the 1st combo box the range of 2nd combo box starts from 11 to 20.

can any one have an idea how to do the same?

in anticipation for help and thanks.:sign0085:
 

klaus

Expert
Licensed User
Hello mozaharul

I have joined a small example of your question.
With two comboboxes initialized at the beginning.

If you select 1 in Combobox1,
Combobox2 is initialized with values 11 to 20

If you select 2 in combobox 1,
Combobox2 is initialized with values 21 to 30, and 21 is preselected with
Combobox2.SelectedIndex=0

If now you select 1 in combobox 1 again,
Combobox2 is initialized with values 11 to 20
but the value 21 in Combobox2 remains because no Item was initialized.

The first initialization of the two Comboboxes, are different.

Combobox1 has a selected Item and displays 1

Combobox2 doesn't have selected Item and displays nothing.

After initializing a combobox you must select an default item.

Best regards
Klaus
Switzerland
 

Attachments

Top