Is it possible too change numbers into text?. I have two textboxes, textbox one has a value like 85.22, can textbox2 read as Eighty Five Dollars and 22/100 ?. No matter what textbox1 value is it will read text in the second textbox.
Thanks for any Help you can give me. Z
Thank You, I got this code off the interent and I'm not sure how too adapt for my needs. New too VS so I'm a little slow on this. This code does the words nice, I need textbox 2 value too control the words. Not sure how too get 22/100 after the text. For example I'm using 85.22 in text box 2.
Thanks
Looks like you're making it too complicated. Here's some VB6 code, so you can see the logic that it uses. Using Exponents is probably converting into Long, btw.
Code:
Option Explicit
Private Sub Command1_Click()
Dim num As Long
Dim str As String
num = Val(Text1.Text)
str = convert(num)
MsgBox str
End Sub
Private Sub Form_Load()
Text1.Text = 1240
End Sub
Function convert(n As Long) As String
Dim s As String
Dim x As Integer
If n > 1000 Then
x = (n \ 1000)
s = sngl(x) & " Thousand"
n = n - (x * 1000)
End If
If n > 100 Then
x = (n \ 100)
s = s & sngl(x) & " Hundred "
n = n - (x * 100)
End If
If n > 10 Then
x = (n \ 10)
Select Case x
Case 2
s = s & "Twenty"
Case 3
s = s & "Thirty"
Case 4
s = s & "Fourty"
Case 5
s = s & "Fifty"
Case 6
s = s & "Sixty"
Case 7
s = s & "Seventy"
Case 8
s = s & "Eighty"
Case 9
s = s & "Ninety"
End Select
n = n - (x * 10)
End If
s = s & sngl(CInt(n))
If n = 0 Then s = "Zero"
convert = s
End Function
Function sngl(x As Integer) As String
Dim s As String
Select Case x
Case 1
s = s & " One"
Case 2
s = s & " Two"
Case 3
s = s & " Three"
Case 4
s = s & " Four"
Case 5
s = s & " Five"
Case 6
s = s & " Six"
Case 7
s = s & " Seven"
Case 8
s = s & " Eight"
Case 9
s = s & " Nine"
End Select
sngl = s
End Function
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.