I have the following code. I would like to perform a if then check via a button click before the user processes the information.
Private Sub TestBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestBTN.Click
If TBSearch.Text = "" & ".exe" Or TBSearch.Text = "" & "" Or TBSearch.Text = ".""*" & ".**" Then TBSearch.BackColor = Color.Aqua Else TBSearch.BackColor = Color.Red
End Sub
I would like it to just check to see if the text box info has been entered in one of three formats.
1)blah.blah
2)blah*.blah
3)blah*.*
I hope I explained this right.
You can use regular expressions:
(System.Text.RegularExpressions.Regex)
^[^\*]+(\*?\.[^\*]+|\*\.\*)$
will validate any word of the form: (any character != *) followed by (*.) or (.) followed by (*) or (any character != *)