|
-
May 15th, 2012, 02:33 AM
#1
[RESOLVED] Textbox question
Hi,
I have a textbox and a richtextbox, if the value in textbox matches any value in the richtext box then I want to display text in a label.
I have some coding but its not exactly what I'm after
Code:
if Richtextbox1.text.Contains(Textbox1.text)
The problem with the above code is that it doesnt check the whole value in richtextbox1 ie if richtextbox has
Tom 22 12 52
Ant 86 73 91
and textbox has '1' the label will display when it should only display if the textbox has value of 22, 12, 52, 86, 73, or 91.
what have i done wrong? thanks
-
May 15th, 2012, 05:41 AM
#2
Re: Textbox question
Split the string from the Rich Text box, using space as a separator. Then compare the text from Textbox1 with each of these strings in turn.
Documentation here:
http://msdn.microsoft.com/en-us/library/b873y76a.aspx
-
May 15th, 2012, 07:10 AM
#3
Re: Textbox question
Sorry im very much a newbie, could you give me a quick example?
Code:
Dim split As String() = words.Split(New [Char]() {" "c, CChar(vbTab) })
For Each s As String In split
If s.Trim() <> "" Then
Console.WriteLine(s)
End If
Next s
If textbox1.text = S then
' my coding
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|