I am trying to make telephone number word generator, user enters phone number 7 digits between 2 to 9 and then it generates all possible word combinations,
it should be 3 ^ 7 = 2187
This is what I got so far:
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)
array1 = {{"A", "B", "C"}}
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 know it is a mess I cannot figure out how to remove those substrings and to place in this array and then print :
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"}}
Some hints would be great...
Thank you!