Private Sub GenerateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GenerateButton.Click
    Dim i As String = PhoneNumberTextBox.Text
    Dim one As Integer = i.Substring(0, 1) 'Remove each digit
    Dim two As Integer = i.Substring(1, 1)
    Dim three As Integer = i.Substring(2, 1)
    Dim four As Integer = i.Substring(3, 1)
    Dim five As Integer = i.Substring(4, 1)
    Dim six As Integer = i.Substring(5, 1)
    Dim seven As Integer = i.Substring(6, 1)
    calculate(one)
    calculate(two)
End Sub

Function calculate(ByVal number As Integer)
    If number = 1 Or 0 Then
        MessageBox.Show(" Please input numbers between 2 to 9 ")
    ElseIf number = 2 Then
        For r As Integer = 0 To array1.GetUpperBound(0)

            Dim array1(,) As String = {{"A", " B", " C"}, {"D", " E", " F"}, _
            {"G", " H", " I"}, {"J", " K", " L"}, {"M", " N", " O"}, _
            {"P", " R", " S"}, {"T", " U", " V"}, {"W", " X", " Y"}}

            For i As Integer = 0 To array1.GetUpperBound(1)
                ' PhoneNumberWordsListBox.Items.Add(array1(0, i))
                For number1 As Integer = 0 To array1.GetUpperBound(0)
                    ' PhoneNumberWordsListBox.Items.Add(array1(0, i))
                    ' TextBox1.AppendText(vbCrLf & array1(0, i))
                Next
            Next
        Next
    Return number
End Function

I don't see a question and you didn't bother to say what you want your code to do, but once I corrected your formatting (please use the Code tool to post code) it was obvious that you were missing an End If. You also do not do anything with the returned value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.