|
-
Oct 20th, 2000, 11:10 PM
#1
Thread Starter
New Member
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!!!
-
Oct 20th, 2000, 11:57 PM
#2
This tip from Vb-World.net should help you get started.
-
Oct 21st, 2000, 12:00 AM
#3
Lively Member
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()
-
Oct 21st, 2000, 09:39 AM
#4
Thread Starter
New Member
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!
-
Oct 21st, 2000, 10:17 AM
#5
Frenzied Member
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.
-
Oct 21st, 2000, 05:01 PM
#6
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|