Results 1 to 6 of 6

Thread: What more can I try?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3

    Question

    I am trying to figure out the best way to complete a task. Here is what I'm trying to do:

    Enter this information into text box one:

    12345

    Have text box two display the same information like this:

    one, two, three, four, five

    This should be able to accomplish this in any numeric order with the trailing comma left off after the last digit.

    Can anybody give me some help or point me in the right direction? Thanks in advance!!!

  2. #2
    Guest
    This tip from Vb-World.net should help you get started.

  3. #3
    Lively Member
    Join Date
    Apr 2000
    Posts
    70

    Lightbulb

    Well, how about this:

    Cycle through each character in turn, for each one, check what number it is, and append the appropriate string value and a comma to the end of the output. once at the end of the loop, you can remove the last comma.

    Note: I didnt show you any code because ithink it is beneficial to figure it out yourself, so figure some out, at least try, and post it back here, then if it is incorrect i will help more
    Daniel Rose
    VB 5.0 Enterprise.
    irc:irc2.dynam.ac

    If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3

    Smile Still trying...

    Thanks for the tips and advice. I am really new to VB (if you couldn't tell) and I truly appreciate forums and people like yourselves willing to help out the newbies. Here is my code so far:

    Private Sub txtNumber_Change()
    Dim tempstr As String
    tempstr = txtNumber.Text
    Select Case Int(tempstr)
    Case 1
    txtConversion.Text = "one"
    Case 2
    txtConversion.Text = "two"
    Case 3
    txtConversion.Text = "three"
    Case 4
    txtConversion.Text = "four"
    Case 5
    txtConversion.Text = "five"
    Case 6
    txtConversion.Text = "six"
    Case 7
    txtConversion.Text = "seven"
    Case 8
    txtConversion.Text = "eight"
    Case 9
    txtConversion.Text = "nine"
    End Select
    End Sub

    This will take the number I have in txtNumber and change it to the text equivilant in txtConversion. Now, how do I get it to ignore the first number I enter into in txtNumber and process the new number. For example:

    12 should be equivilant to 1 and 2 not 12 (twelve)

    Also, I can't figure out how to make it append to the string in txtConversion. Any help would be greatly appreciated!


  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    You were almost there, but I suggest the text1_KeyDown, this will work:

    Code:
    Private Sub txtNumber_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKey1
    txtConversion.Text = txtConversion.Text & "one "
    Case vbKey2
    txtConversion.Text = txtConversion.Text & "two "
    Case vbKey3
    txtConversion.Text = txtConversion.Text & "three "
    Case vbKey4
    txtConversion.Text = txtConversion.Text & "four "
    Case vbKey5
    txtConversion.Text = txtConversion.Text & "five "
    Case vbKey6
    txtConversion.Text = txtConversion.Text & "six "
    Case vbKey7
    txtConversion.Text = txtConversion.Text & "seven "
    Case vbKey8
    txtConversion.Text = txtConversion.Text & "eight "
    Case vbKey9
    txtConversion.Text = txtConversion.Text & "nine "
    End Select
    End Sub
    Have fun man
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    3

    Talking Kewl! Thanks so much!

    It's nice to know I was at least headed in the right direction! Maybe I can learn this stuff! Thanks for the assistance!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width