C
Carlos
Hi,
I am traversing a list box and comparing its entries
with a string. I am not able to find a method that
allows me to use the current index to retrieve the value.
can you help? here is what I got
if ( listBox1.Items.Count > 0 )
{
for (int x = 1; x <= listBox1.Items.Count ; x++)
{
if ( listBox1.GetItemText(x)== textBox1.Text ) //does not
work..
MessageBox.Show("found "+textBox1.Text);
else
listBox1.Items.Add("Item " +
x.ToString());
}
}
else
listBox1.Items.Add(textBox1.Text);
Thanks
I am traversing a list box and comparing its entries
with a string. I am not able to find a method that
allows me to use the current index to retrieve the value.
can you help? here is what I got
if ( listBox1.Items.Count > 0 )
{
for (int x = 1; x <= listBox1.Items.Count ; x++)
{
if ( listBox1.GetItemText(x)== textBox1.Text ) //does not
work..
MessageBox.Show("found "+textBox1.Text);
else
listBox1.Items.Add("Item " +
x.ToString());
}
}
else
listBox1.Items.Add(textBox1.Text);
Thanks