Hi,
My form is - a listbox which contains 5 items, a textbox and a button.
ListBox - subjectListBox
TextBox - subjectTextBox
When the button is clicked, I want the 5 items in the listbox to be
compared to the text in the textbox (note: items in listbox are single
words - text in textbox can be many words) - and if any of the items in
the textbox match the an item in the list box, I want a message to
appear.
The error message I keep getting is: 'string' does not contain a
definition for 'Contains'
Here is the code I am trying to use within the button:
int counter;
int flag=0;
for (counter = 0; counter < 5; counter++){
if
(subjectTextBox.Text.Contains(subjectListBox.Items[counter].ToString()))
flag=1;
}
if (flag==1)
MessageBox.Show(strMessage);
I have emailed someone else who tested this code - and it worked for
them!
When this happend, I started a new project, and tried it again from
fresh - still not working.
Possibly a problem with my VSC#2003 insallation?
Any help would be greatly appreciated.