Click here to Skip to main content
15,075,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am making a software where I need vb to read each word in a textbox individually from one textbox and check it against a second textbox.

How do I tell vb to check if any of the words from textbox1 match with any of the words from textbox2 then it should show form2 otherwise it can show form3?

note: textbox1 and texbox2 are on form1.

thanks to any helpers

Updated 31-Aug-10 14:03pm
Dalek Dave 31-Aug-10 20:03pm
Minor edit for grammar.

IF statements, regular expressions (or IndexOf), Text properties, a while loop (or for loop) and comparison operators.

What have you tried so far? What, specifically, is stopping you from completing this task? Seems like you are asking us to code this whole thing for you... you haven't given us a specific problem you encountered that we can help you solve.
hamza_786 31-Aug-10 18:37pm

i have tried the following:

Dim r As Integer

textbox1.Text = source
TextBox2.Text = "word1"

Checking_Site.Value = Checking_Site.Maximum

r = textbox1.Text.IndexOf(TextBox2.Text)
If r > 0 Then
End If

but i don't know how to tell vb to add more words and find them individually. at the moment it is just looking for 'word1'.

p.s. checking_site is a progress bar which i also have on form1
Christian Graus 31-Aug-10 18:58pm
That won't work at all. It just checks for the whole word. Try doing what I suggested, instead.
Well, this is pretty basic. Call the split method on the string class to get a list of words, then you can use the Contains method of the string class to check each word in order, if it's in the other string. Perhaps you should buy a VB.NET book and read it to understand the basics of how it works ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900