|
-
September 13th, 2001, 01:10 AM
#1
printer object alignment
how can I aligned printing of numbers from left-justified to right-justified ;
vValue1=xxx.xx
vValue2=xxxx.xx
vValue3=xx.xx
Printer.print "Value No 1 : " & vValue1
Printer.print "Value No 2 : " & vValue2
Printer.print "Value No 3 : " & vValue3
results
Value No 1 : xxx.xx
Value No 2 : xxxx.xx
Value No 3 : xx.xx
thanks
cyrus
-
September 13th, 2001, 02:33 AM
#2
Re: printer object alignment
You may set the currentx property of printer:
http://codeguru.com/cgi-bin/bbs/wt/s...age=&view=&sb=
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
September 13th, 2001, 02:34 AM
#3
Re: printer object alignment
Another trick: store numbers in string variable of fixed lenght, aligned to right with format function. Then print the string variables.
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
September 13th, 2001, 03:30 AM
#4
Re: printer object alignment
As Cimperiali implied, you will have to use the CurrentX property. Then, in assosiation with the TextWidth, you can determine where to start. Note tha in the code I used Me instead of Printer, which results in the text being printed on the form.
Dim sWidth as Long
' compute point where it must be alligned, you can give this a fixed value if you want
sWidth = me.TextWidth("000000.00")
me.CurrentX = sWidth - me.TextWidth("1234.56")
me.print "1234.56"
me.CurrentX = sWidth - me.TextWidth("123.45")
me.print "123.45"
me.CurrentX = sWidth - me.TextWidth("12345.67")
me.print "12345.67"
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
September 17th, 2001, 12:46 AM
#5
Re: printer object alignment
excellent, but I left one major issue ,a text preceeded the numbers
ie
vGross=123.45
vDiscount=23.45
vNett=100.00
printer.currentx = sWidth - printer.textwidth(vGross)
printer.print "Gross : " & vGross
printe.currentx=swidth - printer.textwidht(vDiscount)
printer.print "Discounts : " & vDiscount
printer.print " ----------------- "
printer.currentx=swidth - printer.textwidht(vNett)
printer.print "Nett : " & vNett
using Currentx affects alignment of text
thanks in advance
cyrus
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|