![]() ![]() | ||
It's time to put new items into a combo box—but does that mean you have to delete all the current items there one by one with Remove or RemoveAt? No, you can clear a whole combo box at once with the Items.Clear method. Here's an example where I'm clearing a combo box when the user clicks a button:
Private Sub Button1_Click_1(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
ComboBox1.Items.Clear()
End Sub
Note that there is no "Unclear" method—once you remove the items from a combo box, they're gone until you expressly add them again.
Tip |
The Clear method does not clear the text in the combo box's Text property. |
![]() ![]() | ||