Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Mar 16, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using Format Function to Right Justify

When using printer.print statements to send output directly to the printer, it used to be possible in QB PDS to use something like "printer.print format(number, "###,###.00") to get right justification of numbers on successive lines. Now, although the MS documentation says that the "#" characters act as placeholders, they actually do not. How can you format numbers so that they right-justify on a printout?

If you know how long your field is (maximum length), you can simply subtract the length of your formatted number from it. You then add that many spaces to the front of the number. That will force the string to the right.

On 3/31/00, Marty Liss responded:
This is incorrect. It is true only if you are using a fixed-width font like Courier, otherwise the leading spaces are thinner than the numbers so the justification that results from this tip is ragged.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date