❓ [Help] Searching A Textbox
Yes it works
:

Just used this code:
(Textbox1 = Your TExt , txtSearch = You text to search)
[highlight=VB.NET]
If Textbox1.Text.Contains(txtSearch.Text) Then
Textbox1.SelectionStart = Textbox1.Text.IndexOf(txtSearch.Text)
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Else
If Textbox1.Text.Contains(UCase(txtSearch.Text)) Then
Textbox1.SelectionStart = Textbox1.Text.IndexOf(UCase(txtSearch.Text))
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Else
Try
Textbox1.SelectionStart = Textbox1.Text.IndexOf(LCase(txtSearch.Text))
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Catch ex As Exception
MsgBox("Not FOUND")
End Try
End If
End If
[/highlight]
The only problem in my code is: Just find the first "word" example:
There is 2 Hellos
Then i seach Hello
It just highlight the first one , Idk how to search the next one
@Jason it still works =)
:
Just used this code:
(Textbox1 = Your TExt , txtSearch = You text to search)
[highlight=VB.NET]
If Textbox1.Text.Contains(txtSearch.Text) Then
Textbox1.SelectionStart = Textbox1.Text.IndexOf(txtSearch.Text)
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Else
If Textbox1.Text.Contains(UCase(txtSearch.Text)) Then
Textbox1.SelectionStart = Textbox1.Text.IndexOf(UCase(txtSearch.Text))
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Else
Try
Textbox1.SelectionStart = Textbox1.Text.IndexOf(LCase(txtSearch.Text))
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
Catch ex As Exception
MsgBox("Not FOUND")
End Try
End If
End If
[/highlight]
The only problem in my code is: Just find the first "word" example:
There is 2 Hellos
Then i seach Hello
It just highlight the first one , Idk how to search the next one
@Jason it still works =)
THATS A DUMB THING! -.-
YOU CAN JUST MAKE A CONTEXT MENU STRIP OH MY FUKIN GOD
But i did this:
Working!!!
But its not like a button "next" , it just find the first one.
YOU CAN JUST MAKE A CONTEXT MENU STRIP OH MY FUKIN GOD

But i did this:
Code:
If InStr(Textbox1.Text, txtSearch.Text, CompareMethod.Text) Then
Textbox1.SelectionStart = InStr(Textbox1.Text, txtSearch.Text, CompareMethod.Text) - 1
Textbox1.SelectionLength = txtSearch.Text.Length
Textbox1.Select()
End If
But its not like a button "next" , it just find the first one.
This thread is closed for replies.



