Simple made programme for testing purpose.user take input from 1 to nine.and function convert that numeric number into text like one two ...nine. function is working fine .but the number in words is not comming in Upper case.Kindly let me know the idea.any help would be highly appreciated.
Public Function NumberToWords(x As Integer) As String
Dim Numbers(9) As String
Numbers(1) = "One"
Numbers(2) = "Two"
Numbers(3) = "Three"
Numbers(4) = "Four"
Numbers(5) = "Five"
Numbers(6) = "Six"
Numbers(7) = "Seven"
Numbers(8) = "Eight"
Numbers(9) = "Nine"
Select Case Val(x)
Case 1: NumberToWords = "One"
Case 2: NumberToWords = "Two"
Case 3: NumberToWords = "Three"
Case 4: NumberToWords = "Four"
MsgBox (NumberToWords)
Case 5: NumberToWords = "Five"
MsgBox (NumberToWords)
Case 6: NumberToWords = "Six"
Case 7: NumberToWords = "Seven"
Case 8: NumberToWords = "Eight"
Case 9: NumberToWords = "Nine"
Case Else: NumberToWords = ""
End Select
End Function
Private Sub TxtAmount_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub TxtAmount_LostFocus()
Dim Amount As Integer
Amount = Val(TxtAmount.Text)
TxtPaymentInWords.Text = NumberToWords(Amount)
TxtPaymentInWords.SetFocus
End Sub
Private Sub TxtPaymentInWords_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub