2
How to clean a ListBox
?
I did it this way but it didn’t work:
private void LimparListBox()
{
//lbxResumo.Text = "";
lbxResumo.ClearSelected();
}
private void btnLimparList_Click(object sender, EventArgs e)
{
LimparListBox();
}
2
How to clean a ListBox
?
I did it this way but it didn’t work:
private void LimparListBox()
{
//lbxResumo.Text = "";
lbxResumo.ClearSelected();
}
private void btnLimparList_Click(object sender, EventArgs e)
{
LimparListBox();
}
1
You need Items.Clear()
to clear the textbox.
Example:
private void LimparListBox()
{
//lbxResumo.Text = "";
lbxResumo.Items.Clear();
}
private void btnLimparList_Click(object sender, EventArgs e)
{
LimparListBox();
}
Source: https://msdn.microsoft.com/pt-br/library/ms228375(v=vs.90). aspx
0
The correct command would be:
List.Items.Clear
Put your Listbox name instead of List
The example you used:
lbxResumo.ClearSelected();
clears only the selected item.
Browser other questions tagged c# listbox
You are not signed in. Login or sign up in order to post.