Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How to check if a bounded listbox contains text?

$
0
0

Hi All,

I have a bounded listbox. I can add items to it with:

currentOptionsTableTableAdapter1.Insert(textBoxAdd.Text);
currentOptionsTableTableAdapter1.Update(this.optionData_DS.currentOptionsTable);

after I add strings to it I need to check that I'm not adding something that is already in it. I was using this without success:

if (currentOptionsTableListBox.Items.Contains(textBoxAdd.Text))
{
   MessageBox.Show("Symbol already exist", "Can not add");
   return;
}

It seems to work for an unbounded listbox. How do I do this for a bounded listbox?

Thanks


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>