<-- Previous || Up || Next -->

Convert Special Sample Sub
Units Class

Private Sub ConvertSpecialSample()
    ' Perform some sample conversions using the ConvertSpecial function.

    ' Will perform each of the sample conversions twice.
    ' The first time, the result is expressed as a fraction (if appropriate) and the next time the
    ' result is expressed as a decimal number.
    Dim intAsFraction As Integer
    For intAsFraction = True To False
        Debug.Print

        Debug.Print "Express as fraction? ";
        If intAsFraction Then
            Debug.Print "Yes"
        Else
            Debug.Print "No"
        End If

        Debug.Print "Convert 11 feet and 11 15/16 inches to meters:"
        Debug.Print ConvertSpecial("11' 11 15/16""", "m", Null, Null, intAsFraction)

        Debug.Print "Convert 11 feet and 11 15/16 inches back to feet and inches, rounding the nearest 64th of an inch:"
        Debug.Print ConvertSpecial("11' 11 15/16""", "'", """", 64, intAsFraction)

        Debug.Print "Convert 3.4567 meters to feet, rounding the result to the nearest 64th of a foot:"
        Debug.Print ConvertSpecial("3.4567m", "'", "", 64, intAsFraction)

        Debug.Print "Convert 3.4567 meters to feet and inches, rounding the result to the nearest 64th of an inch:"
        Debug.Print ConvertSpecial("3.4567m", "'", """", 64, intAsFraction)

        Debug.Print "Convert -3.4567 meters to feet and inches, rounding the result to the nearest 64th of an inch:"
        Debug.Print ConvertSpecial("-3.4567m", "'", """", 64, intAsFraction)
    Next intAsFraction
End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.