C# Programming
01-28-2010, 01:50 PM
hi
i m inserting some vlues into a listbox but now i want to
restrict the duplication of entries in the list box
private void lblpush_Click(object sender, EventArgs e)
{
for (int i = 0; i < tbxnumber.Text.Length - 1; i++)
{
if (list1.Items[i] == tbxnumber.Text[i]) return;
object list = tbxnumber.Text[i];
list1.Items.Add(list);
}
}
but it does not work
i m inserting some vlues into a listbox but now i want to
restrict the duplication of entries in the list box
private void lblpush_Click(object sender, EventArgs e)
{
for (int i = 0; i < tbxnumber.Text.Length - 1; i++)
{
if (list1.Items[i] == tbxnumber.Text[i]) return;
object list = tbxnumber.Text[i];
list1.Items.Add(list);
}
}
but it does not work