Hi, I was wondering if any could help out a newbie in programming. I am currently in College taking Intro to Programming and I am having difficulties with making a Phone Words program that does the following:

Transform words to numbers (Phone Numbers)
and
Transform numbers to words (Having a combo box underneath the output textbox to give the user the chance to use one of the 3 letters within that number.)

If anyone could show me how to do the code... nothing too advanced... I'm only a starter. Thanks alot!

:mrgreen:

Recommended Answers

All 4 Replies

Why don't you post what you have so far?
No one is going to code your whole assignment for you for free.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Word2Number_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Word2Number.Click
Dim Letter As String
Dim Result As String
For Each Letter In Word_Input.Text
Select Case Letter
Case "A", "B", "C", "a", "b", "c" : Letter = "2"
Case "D", "E", "F", "d", "e", "f" : Letter = "3"
Case "G", "H", "I", "g", "h", "i" : Letter = "4"
Case "J", "K", "L", "j", "k", "l" : Letter = "5"
Case "M", "N", "O", "m", "n", "o" : Letter = "6"
Case "P", "R", "S", "p", "r", "s" : Letter = "7"
Case "T", "U", "V", "t", "u", "v" : Letter = "8"
Case "W", "X", "Y", "w", "x", "y" : Letter = "9"
Case "Q", "q" : Letter = "1" 'Q/q is given the number 1
Case "Z", "z" : Letter = "0" 'Z/z is given the number 0
End Select
Result = Result & Letter
Next
Number_Output.Text = Result
End Sub

Private Function Phone_Number_Lookup(ByVal digit As String) As String
Select Case digit
Case "1" : Return "1Q"
Case "2" : Return "2ABC"
Case "3" : Return "3DEF"
Case "4" : Return "4GHI"
Case "5" : Return "5JKL"
Case "6" : Return "6MNO"
Case "7" : Return "7PRS"
Case "8" : Return "8TUV"
Case "9" : Return "9WXY"
Case "0" : Return "0Z"
End Select
Return "Error"
End Function

Private Sub Do_It_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Do_It.Click
Dim i As Integer
Dim s As String = Number_Input.Text
Dim digit As String
s = s & " "
For i = 1 To 10
digit = s.Substring(i - 1, 1)
MessageBox.Show(digit)
'Set_ComboBox_Items(Digit_1, Number_Input.Text)
'Set_ComboBox_Items(Digit_2, Number_Input.Text)
'Set_ComboBox_Items(Digit_3, Number_Input.Text)
'Set_ComboBox_Items(Digit_4, Number_Input.Text)
MessageBox.Show(Phone_Number_Lookup(digit))
If digit Is "1" Then
Set_ComboBox_Items(Digit_1, Number_Input.Text)
ElseIf digit Is "2" Then
Set_ComboBox_Items(Digit_2, s)
ElseIf digit Is "3" Then
Set_ComboBox_Items(Digit_3, s)
ElseIf digit Is "4" Then
Set_ComboBox_Items(Digit_4, s)
ElseIf digit Is "5" Then
Set_ComboBox_Items(Digit_5, s)
ElseIf digit Is "6" Then
Set_ComboBox_Items(Digit_6, s)
ElseIf digit Is "7" Then
Set_ComboBox_Items(Digit_7, s)
ElseIf digit Is "8" Then
Set_ComboBox_Items(Digit_8, s)
ElseIf digit Is "9" Then
Set_ComboBox_Items(Digit_9, s)
ElseIf digit Is "0" Then
Set_ComboBox_Items(Digit_0, s)
End If
Next
End Sub

Private Sub Set_ComboBox_Items(ByVal C As ComboBox, ByVal S As String)
Dim Letter As String
C.Items.Clear()
C.Text = S.Substring(0, 1)
For Each Letter In S
C.Items.Add(Letter)
Next
End Sub
End Class
' Digit = Original_Text.Substring(0,1)
' If Digit = "1" Then
' Set_ComboBox_Items (Digit_1, "Q")
' Elseif Digit = "2" Then
' Set_ComboBox_Items (Digit_2, "2ABC")
' ...
'
' End If

Member Avatar for iamthwee

Question?

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.