(Right(TensText, 1)) ' Retrieve ones place. If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19. Result = "" ' Null out the temporary function value. This function will convert a number from 10 to 99 into text: Function GetTens(TensText) Result = Result & GetDigit(Mid(MyNumber, 3)) Result = Result & GetTens(Mid(MyNumber, 2)) Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred " MyNumber = Left(MyNumber, Len(MyNumber) - 3)įollowings are the supported functions: Converts a number from 100-999 into text Function GetHundreds(ByVal MyNumber) If Temp "" Then Dollars = Temp & Place(Count) & Dollars ![]() MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) ' Convert cents and set MyNumber to dollar amount.Ĭents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ Basic Vb programs Example 2.1.1 Private Sub FormLoad ( ) Form1.show Print Welcome to Visual Basic tutorial End Sub Example 2.1.2 Private Sub FormActivate ( ) Print 20 + 10 Print 20 - 10 Print 20 10 Print 20 / 10 End Sub You can also use the + or the & operator to join two or more texts (string) together like in example 2.1. ![]() Code example Public Function SpellNumbersIntoWords(ByVal MyNumber) ![]() User might come across where he wanted to spell the numbers into words where he is showing Total amount of his invoice.
0 Comments
Leave a Reply. |