I need a way to tell me if a certain word already exists in a multi-lined textbox. Right now I have a multi-lined textbox with some names inside it. After each name I add a newline so all the names are on their own line inside the textbox.
I use this code to add names to the textbox,
TextBox1.AppendText(ComboBox1.Text + vbCrLf)
Then I have been checking if the name exists by doing it this way,
If TextBox1.Text.Contains(ComboBox1.Text) = True Then
MsgBox("Yes")
Else
MsgBox("No")
End If
I have ran into a problem because lets say My textbox names look like this:
Ted
Frank
Ben
Teddy
The problem is that Ted and Teddy return the same when searching for Ted even if Ted isnt in the textbox at all, I have googled for the last few days and even tried RegularExpressions and still the same results. I think this might be a simple true or false check but I may be wrong... or even a loop or something line by line...
Any help in the right direction would be great,
Thanks for ready this.

New Topic/Question
Reply



MultiQuote




|