Clear the items of a combobox in visual basic(windows application)
<p>I have written this code to clear the items of a combobox</p>

<p>But the problem i am facing is when I select "a" from ComboBox1 then ComboBox2 displays "1","2"and "3" and suppose if I select "1" from ComboBox2 then next When I change the value of ComboBox1 to "b" then "4","5" and "6" are displayed in the drop down menu of ComboBox2 but the selected value in ComboBox2 remains as "1" </p>

<pre><code>If ComboBox1.text="a" then
ComboBox2.items.clear()
ComboBox2.items.add("1")
ComboBox2.items.add("2")
ComboBox2.items.add("3")
ElseIf ComboBox1.text="b" then
ComboBox2.items.clear()
ComboBox2.items.add("4")
ComboBox2.items.add("5")
ComboBox2.items.add("6")
ElseIf ComboBox1.text="c" then
ComboBox2.items.clear()
ComboBox2.items.add("7")
ComboBox2.items.add("8")
ComboBox2.items.add("9")
Else
ComboBox2.items.clear()
End if
</code></pre>