I'm trying to check if the label contains certain word, how can I do that?
I have label1 with Text: THIS IS YOUR LAST TEST I have blank textbox1 for searching I have button1 to search the input text on textbox1 from label1.
For example, I want to search "LAST", how can I do that?
If I type LAST on the textbox1 Then
If label1 have the word typed on textbox1 Then
Msgbox("You found me")
End If
Can you help me? I'm new and I'm using VB net
CodePudding user response:
If label1.Text.IndexOf(textbox1.Text) <> -1 Then
MsgBox("Your Message.")
End If
OR
If Not string.isNullOrEmpty(textbox1.Text) andAlso label1.Text.ToUpper.Contains(textbox1.Text.ToUpper) Then
MsgBox("Your Message.")
End If