Formatting Listbox

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I'm using this function to right align Currency in a listbox. It works
great when all of the Prices are $0.00 or when all of the prices are
$00.00 but not when they are both. Can anone see why?

Function PaddedCurrency(Num, Size)
Dim Pad, Fmt
Fmt = Format(Num, "currency")
Pad = String(Size - Len(Fmt), Chr(32))
PaddedCurrency = Pad & Fmt
End Function

Thanks
DS
 
DS said:
I'm using this function to right align Currency in a listbox. It works
great when all of the Prices are $0.00 or when all of the prices are
$00.00 but not when they are both. Can anone see why?

Function PaddedCurrency(Num, Size)
Dim Pad, Fmt
Fmt = Format(Num, "currency")
Pad = String(Size - Len(Fmt), Chr(32))
PaddedCurrency = Pad & Fmt
End Function


I think your problem may be that you're using a proportional
font, Space characters are a different width then the
number characters.

What you have should work if you use a fixed width font such
as Courier.
 
Marshall said:
I think your problem may be that you're using a proportional
font, Space characters are a different width then the
number characters.

What you have should work if you use a fixed width font such
as Courier.
I'm using Ariel Truetype....
Which is the font used throughout the system.
Anyway to use Ariel.
Thanks
DS
 
See:
http://www.lebans.com/justicombo.htm
New Ver 2.1 Justification.zip is a database containing functions to center
and right justify data for List and Combo Boxes.

http://www.lebans.com/textwidth-height.htm

TextHeightWidth.zip is a replacement for the Report object's TextWidth and
TextHeight methods. It is multiline aware and can work in both Report and
Form views. Includes a sample report to show you how to autosize individual
controls with different formatting on the same line to simulate RTF style
text.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top