Search textbox.

Posts 1–11 of 11 · Page 1 of 1
Search textbox.
Hey i've came across something i never thought i would need. But
Is it possible to do, Textbox1 and have it find a word in Textbox2 Multiline???
Sort of like control find but a little easier?
Thanx Rep to whoever helps.


@Jason
@Blubb1337

Can you rephrase that sentence please?

Do you just want to check if textbox2 contains textbox1, or do you want to highlight textbox2's text(if it matches with textbox1)...? Or do you want to know the line it is found?
U mean this?

Code:
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If TextBox2.Text = ("Something") Then TextBox1.Text = ("Something")
    End Sub
End Class
Quote Originally Posted by hustelboy View Post
U mean this?

Code:
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If TextBox2.Text = ("Something") Then TextBox1.Text = ("Something")
    End Sub
End Class
Well, this would not work so good.

Cuse he gone make like a search bar for his multilined textbox..

So textbox1 is the seach bar..
then textbox2 is the multi-lined text he want to search in for a word.

Or am i wrong?
Quote Originally Posted by Jorndel View Post
Well, this would not work so good.

Cuse he gone make like a search bar for his multilined textbox..

So textbox1 is the seach bar..
then textbox2 is the multi-lined text he want to search in for a word.

Or am i wrong?
It's .NET pratically everything is easy. All he has to do is make a variable with whatever string the user has entered, and with the help of a ugly looking Syntax, and a if statement he can then match the string with whatever .NET component he's dealing with.

Does not get any bit easier than that.
Quote Originally Posted by VirtualSia View Post
It's .NET pratically everything is easy. All he has to do is make a variable with whatever string the user has entered, and with the help of a ugly looking Syntax, and a if statement he can then match the string with whatever .NET component he's dealing with.

Does not get any bit easier than that.
I've never tried to do this till now i know vb... not very advanced but enough to succeed.
You want this?
Code:
If TextBox2.Text = ("Hello") Then TextBox1.Text = ("Welcome")
Code:
If textbox2.contains(textbox1.text) then
          msgbox.show("OHHH")
Quote Originally Posted by alvaritos View Post
Code:
If textbox2.contains(textbox1.text) then
          msgbox.show("OHHH")
@alvaritos like that butt highlight Textbox2's multiline word.
So textbox1[Hack] Textbox2["Hack"-Highlighted.]
You will need a richtextbox as "multiline textbox" to make this work:

[highlight="VB.Net"]Private Sub Highlight(Byval SearchString as string,Byval SelectionColor as Color)
RichTextBox1.Select(RichTextBox1.Text.IndexOf(Sear chString), SearchString.Length)
RichTextbox1.SelectionColor = selectioncolor
End Sub[/highlight]

See if that works, didn't test it.

Usage:

[highlight="VB.Net"]Highlight(Textbox1.Text,Color.Blue)[/highlight]

@FWESFWSERGFwesg
Blub thats a richtextbox

if(InStr(etc...
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us