Click here to Skip to main content
16,007,277 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questiontelephone number word generator Pin
rbjanaki6-Sep-09 11:12
rbjanaki6-Sep-09 11:12 
AnswerRe: telephone number word generator Pin
Henry Minute6-Sep-09 11:39
Henry Minute6-Sep-09 11:39 
GeneralRe: telephone number word generator Pin
rbjanaki6-Sep-09 11:46
rbjanaki6-Sep-09 11:46 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 12:17
Henry Minute6-Sep-09 12:17 
GeneralRe: telephone number word generator Pin
rbjanaki6-Sep-09 12:24
rbjanaki6-Sep-09 12:24 
GeneralRe: telephone number word generator Pin
Hurricane30006-Sep-09 12:31
Hurricane30006-Sep-09 12:31 
GeneralRe: telephone number word generator Pin
rbjanaki6-Sep-09 12:42
rbjanaki6-Sep-09 12:42 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 13:36
Henry Minute6-Sep-09 13:36 
Here are a few ideas to give you a start.

It is just a form with a TextBox (txtResult) and a Button (btnGenerate). I am using a TextBox because I am only doing 1 possibility (you wouldn't want me to deprive you of the fun of doing it yourself, now, would you? Big Grin | :-D ), but you are right ListBox is the way to go. In fact you might want to consider using 3 (or 4 if you allow for the possibility that some keys have 4 possibilities) ListBoxes.

Any way here is what I thought you might use.
Dim input As String = "4247288"

Dim characterLookup As Dictionary(Of Char, Char()) = New Dictionary(Of Char, Char())

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

Private Sub FillCharacterLookup()
    characterLookup.Add("2"c, New Char() {"A"c, "B"c, "C"c})
    characterLookup.Add("3"c, New Char() {"D"c, "E"c, "F"c})
    characterLookup.Add("4"c, New Char() {"G"c, "H"c, "I"c})
    characterLookup.Add("5"c, New Char() {"J"c, "K"c, "L"c})
    characterLookup.Add("6"c, New Char() {"M"c, "N"c, "O"c})
    characterLookup.Add("7"c, New Char() {"P"c, "Q"c, "R"c, "S"c})
    characterLookup.Add("8"c, New Char() {"T"c, "U"c, "V"c})
    characterLookup.Add("9"c, New Char() {"W"c, "X"c, "Y"c, "Z"c})
End Sub

Private Sub OutputResult()
    Dim outArray(7) As Char
    For index As Integer = 0 To input.Length - 1
        outArray(index) = characterLookup(input(index))(0)
    Next
    Me.txtResult.Text = Convert.ToString(outArray)
End Sub

Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
    Me.OutputResult()
End Sub


If you put this code on a form, as described above, run it and click the Generate button you should get "GAGPATT" which is defined as the output from a Cow at an S & M party.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: telephone number word generator Pin
rbjanaki6-Sep-09 14:16
rbjanaki6-Sep-09 14:16 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 14:36
Henry Minute6-Sep-09 14:36 
GeneralRe: telephone number word generator Pin
Luc Pattyn6-Sep-09 12:39
sitebuilderLuc Pattyn6-Sep-09 12:39 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 12:41
Henry Minute6-Sep-09 12:41 
GeneralRe: telephone number word generator Pin
Luc Pattyn6-Sep-09 12:53
sitebuilderLuc Pattyn6-Sep-09 12:53 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 12:58
Henry Minute6-Sep-09 12:58 
GeneralRe: telephone number word generator Pin
Luc Pattyn6-Sep-09 13:14
sitebuilderLuc Pattyn6-Sep-09 13:14 
GeneralRe: telephone number word generator Pin
Henry Minute6-Sep-09 13:15
Henry Minute6-Sep-09 13:15 
Question[Solved] A strange question about strings. [modified] Pin
Hurricane30006-Sep-09 9:53
Hurricane30006-Sep-09 9:53 
AnswerRe: A strange question about strings. Pin
Luc Pattyn6-Sep-09 10:14
sitebuilderLuc Pattyn6-Sep-09 10:14 
GeneralRe: A strange question about strings. Pin
Hurricane30006-Sep-09 10:32
Hurricane30006-Sep-09 10:32 
AnswerRe: A strange question about strings. Pin
εїзεїзεїз6-Sep-09 10:28
εїзεїзεїз6-Sep-09 10:28 
GeneralRe: A strange question about strings. Pin
Hurricane30006-Sep-09 10:33
Hurricane30006-Sep-09 10:33 
AnswerRe: A strange question about strings. Pin
Christian Graus6-Sep-09 11:06
protectorChristian Graus6-Sep-09 11:06 
GeneralRe: A strange question about strings. Pin
Hurricane30006-Sep-09 11:17
Hurricane30006-Sep-09 11:17 
GeneralRe: A strange question about strings. Pin
Christian Graus6-Sep-09 12:31
protectorChristian Graus6-Sep-09 12:31 
GeneralRe: A strange question about strings. Pin
Hurricane30006-Sep-09 12:53
Hurricane30006-Sep-09 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.