Q: Splitting a string and then passing it to a function I have the following code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    If Not TextBox1.Text = "" Then
        If TextBox1.Text.Contains("ping") Then
            Dim PingSplit = TextBox1.Text.Split(" ")
        End If

        Select Case TextBox1.Text

            Case "ping"
                MsgBox(PingSplit(2).ToString)' debug
                '  If Not Regex.Match(PingSplit(2), "\A(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d))\Z").Success Then
                MsgBox("Invalid address!")
                Else
                MsgBox(GetPingMs(PingSplit(2)))
                End If
        End Select

    Else
        MsgBox("System: Please insert a command!")
    End If
End Sub

However I cannot work out how to get the code to split the text in textbox1 and pass the second half to the GetPingMs function, I know the function works, I just cannot work out how to pass the data. Any help would be greatly appreciated.

A: Your PingSplit is declared inside If and is not available in Select.
Also I do not understand which cases your try to select in TextBox1.Text
Move declaration of your 'PingSplit' before all if, but still inside that function:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim PingSplit as String
If Not TextBox1.Text = "" Then
        If TextBox1.Text.Contains("ping") Then
            PingSplit = TextBox1.Text.Split(" ")
        End If

        Select Case TextBox1.Text

            Case "ping"
                MsgBox(PingSplit(1).ToString)' debug

                ' Commented if by question author.
                '  If Not Regex.Match(PingSplit(1), "\A(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d)).(\d{1,2}/(1[0-99]\d)/(2[0-55]\d))\Z").Success Then
                'MsgBox("Invalid address!")
                'Else
                'MsgBox(GetPingMs(PingSplit(1)))
                'End If
        End Select

    Else
        MsgBox("System: Please insert a command!")
    End If
End Sub

