Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear all data in a listBox?

Tags:

I am after a statement that will clear all strings / data that is currently in a listBox, I have tried:

private void cleanlistbox(object sender, EventArgs e) {     listBox1.ResetText(); } 
like image 495
Mike Avatar asked Jun 22 '11 15:06

Mike


People also ask

How do you empty a ListBox?

Clear ListBox With the DataSource = null Approach in C# The best solution for this would be to specify the ListBox. DataSource property equal to null to remove the data source and then use the ListBox. Items. Clear() function to clear the previous items in the list box.

How do I unselect all items in ListBox?

ClearList() and SelectAll() functions The ClearList() function deselects all items in a multi-select list box, or sets the value to Null if the list box is not multi-select. The SelectAll() function selects all the items in a multi-select list box.

How do I clear a ListBox in powershell?

For clearing the listbox you are right in using listbox. Item. Clear() .


1 Answers

What about

listbox1.Items.Clear(); 
like image 99
Ash Burlaczenko Avatar answered Nov 04 '22 00:11

Ash Burlaczenko