• Increase font size
  • Default font size
  • Decrease font size
Visual Basic / VBA

VB Programming: Create Hang Man Game in VB6

E-mail Print PDF

Hang Man is a type of Word Guessing Game use to guess one word by offering letter by letter whether it exists in a guessing word or not. If the offering letter does not exists in the guessing word each part of human body will place to be hanged.

Download Full Source Code

VB Programming: Convert Number to English Word

E-mail Print PDF

How to convert number into English word in VB6 or VBA Programming?

This sample is a conversion of the number into English word which coded in VB6 programming (also support VBA programming). It supports a large range of numbers start from 0 (zero), 10 (ten), 100 (hundred), 1000 (thousand) , 1000 000 (million), 1000 000 000 (billion), 1000 000 000 000 (trillion) until 1000 000 000 000 000 000 000 (sextillion).

You can include this code into your business software to convert number represent the amount (amount of invoice etc.) into English word.

The function to be called for the conversion named ConNumToEngLish with one parameter in String data type.

'    CONVERT NUMBER TO ENGLISH               '
'    BY : IECH SETHA                         '
'    E-Mail: 
 This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Private Const P_ENG_SEXTILLION As String = "sextillion"
Private Const P_ENG_QUINTILLION As String = "quintillion"
Private Const P_ENG_QUADRILLION As String = "quadrillion"
Private Const P_ENG_TRILLION As String = "trillion"
Private Const P_ENG_BILLION As String = "billion"
Private Const P_ENG_MILLION As String = "million"
Private Const P_ENG_THOUSAND As String = "thousand"
Private Const P_ENG_HUNDRED As String = "hundred"

Private Function P_ENG_CONVERT(ByVal pNum As String) As String
'On Error Resume Next
Dim MyOneNum, MyTwoNum
Dim strHun As String
Dim FixLen As Integer

MyTwoNum = Array("", "", "twenty", "thirty", _
                 "fourty", "fifty", _
                 "sixty", "seventy", _
                 "eighty", "ninety")
MyOneNum = Array("", "one", "two", "three", _
                "four", "five", "six", _
                "seven", "eight", "nine", _
                "ten", "eleven", "twelve", _
                "thirteen", "fourteen", "fifteen", _
                "sixteen", "seventeen", "eighteen", "nineteen")
    FixLen = GetFixLen(pNum)
    Select Case FixLen
        Case 2: strHun = P_ENG_HUNDRED
        Case 3: strHun = P_ENG_THOUSAND
        Case 6: strHun = P_ENG_MILLION
        Case 9: strHun = P_ENG_BILLION
        Case 12: strHun = P_ENG_TRILLION
        Case 15: strHun = P_ENG_QUADRILLION
        Case 18: strHun = P_ENG_QUINTILLION
        Case 21: strHun = P_ENG_SEXTILLION
        Case Else: strHun = ""
    End Select

To be continued.....please download source code below
Download Source Code Here


Page 4 of 4