Hi guys,

I am writing the code in the class to create the strings. I want the value to returns as true if the strings in the class are matched with two numbers or more, but if the if the strings in the class are not matched with first two numbers or not then returns the value as false.

Here it is the code:

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim c As New TestStrings.Strings

        If Not c.Strings(Textbox1.Text) Then
            MessageBox.Show("strings not found")
        Else
            Dim a() As String = Textbox1.Text.Split(".", "."c)
            If a.Length < 6 OrElse String.IsNullOrEmpty(a(2)) Then
                MessageBox.Show("strings found!")
            End If
        End If
    End Sub

And the strings in the class.

Code:
 
    Function Strings(ByVal s As String) As Boolean
        Const Strings1 As String = "6."
        Const Strings2 As String = "7."
        Const Strings3 As String = "11."
        Const Strings4 As String = "142.15"

        If s.IndexOf(Strings1) >= 0 Then
            Return True
        ElseIf s.IndexOf(Strings2) >= 0 Then
            Return True
        ElseIf s.IndexOf(Strings3) >= 0 Then
            Return True
        ElseIf s.IndexOf(Strings4) >= 0 Then
            Return True
        End If
        Return False
    End Function
What I am trying to do: input the strings in the textbox "6.11.11.11" and check the strings in the class, if the strings is matched in the class by "6." then displaying the messagebox that says the strings is found. Input the different strings in the textbox like "143.11.11.11" and check the strings in the class, if the strings in the class is not found by the first few two numbers or more, then displaying the messagebox that says the strings is not found.


When I clicked the button by input the strings in the textbox "6.11.11.11", it returns the value as true, but when I input the strings in the textbox "143.11.11.11" which it does not exist in the class, it returns the value as true which it should returns as false.


Please can someone help me?


Thanks,
Mark