View Single Post
Old 07-25-2006, 02:13 PM   #2 (permalink)
Sep102
Forum Expert
 
Join Date: Aug 2004
Location: Redmond, WA
Age: 21
Posts: 1,288
Send a message via AIM to Sep102 Send a message via MSN to Sep102
Default

That's because in C# the "in" keyword is meant to only be used as part of a foreach statement, not to test if a value is a part of a sequence. Also, when using the TextBox class, you cannot treat instances of it as a String, you need to use the Text property (so, textbox.Text, instead of textbox).

Now, what you're looking for is something along the lines of the Contains() method of the String class, which finds a given substring in the string. So to find a substring in the text of a textbox, it would be of the form
Code:
textbox.Text.Contains("substring")
Sep102 is offline   Reply With Quote