QB64 is created to be compatible with Quick Basic 4.5 only as it was the most popular version. The following sub-procedures have been created to do things that were available in Visual Basic:
SCREEN 12 value = 12345.6789 ' any currency value with up to 4 decimal point places _PRINTSTRING (1, 50), "[" + MKC$(value) + "]" ' show ASCII string value END FUNCTION MKC$ (CurrVal AS _FLOAT) 'converts currency amount to currency string DIM CVal AS _INTEGER64 CVal = CurrVal * 10000 MKC = _MK$(_INTEGER64, CVal) END FUNCTION
- The currency amount must be multiplied by 10000 before it is converted to the ASCII string value.
SCREEN 12 DIM currency AS STRING * 8 OPEN "Currency.bin" FOR BINARY AS #1 'binary file with MKC$ values created by PDS or VB GET #1, , currency CLOSE #1 _PRINTSTRING (1, 10), "[" + currency + "]" 'show ASCII string value from file _PRINTSTRING (1, 30), STR$(CVC##(currency)) END FUNCTION CVC## (CurrStr AS STRING) 'converts currency string to currency amount DIM CV AS _INTEGER64 CV = _CV(_INTEGER64, CurrStr) CVC = CV / 10000 END FUNCTION
- The currency amount must be divided by 10000 to create the 4 decimal point places.