General information
Category:
Forms & Form designer
>I've got a listbox that has several columns in it. The source is a SQL statement. The second column is created by the sql segment "transform(total, "$$$,$$$.99")" (just in case that's important). I need to line up the decimal points but don't know how. How can I get these numbers to line up? Thanks!
Hello Denise!
You donnot need to use monospaced font! I use MS SANS SERIFF and with foolowing function works perfectly: It makes equal length strings. I usually use 22 as tnWidth. (You can put the whole function in one big iif statement)
function cFormatCurrency
lparameter tyAmount, tnWidth
local lcVissza, lnSpaceSzam, lyAmount
if sign(tyAmount)=-1
tnWidth=tnWidth+1
endif
lcVissza=alltrim(transform(tyAmount,"### ### ###.##"))
lnSpaceSzam=occurs(' ',lcVissza)
lcVissza=space(max(tnWidth-lnSpaceSzam-2*(len(lcVissza)-lnSpaceSzam-1),0))+lcVissza
return lcVissza
A second solution is: use my free BBListView ocx (available here in UT in file section/ 3rd partyproducts), which natively supports right/center aligned columns.
BB
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only