![]() ![]() | ||
It's time to load new items into a list box-do you really have to clear the old items out one at a time with Remove or RemoveAt?
No, you can use the Clear method to clear a list box. Nothing could be easier (so be careful-there's no "undelete" function here): You just use Clear, like this: ListBox. Clear(). Here's how that looks in code; in this case, I'm clearing a list box, ListBox1, when the user clicks a button:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Clear()
End Sub
![]() ![]() | ||