-
I'm using the format function to format the numbers in a series of listboxes. However, the numbers don't align properly. It would be hard to use spaces in my code because the size of the number for each listbox could vary depending on the query. Is there a way to align the numbers from the far right space of each listbox going left?
The numbers currently look like this:
87566666
12344
0
Thanks!
-
property align in listboxes
listboxes.align=left
or format(num,####0)
# represent the space at right or left depending of your selecction
------------------
carlos alberto perez vergara
[email protected]
analist programming
visual basic 5.0
-
Hi.
Have you tried the @ sign. (e.g.):
list1.text= format(list1.text, "##0.00","@@@@@")
You'll never find it in help! and If it works thank Serge for it. :)
Good Luck.
-
Unfortunately the last time I looked there wasn't an Align Property for the Listbox.
However, you could change the Listbox Font to a Fixed-width Font and Align the Items using Spaces, or you could use the TextWidth Method of the Form to Calculate the No. of spaces you need to align the Proportional Default Font, eg.
Code:
Private Sub Form_Load()
Dim I As Integer
Dim sItem As String
For I = 1 To 100
sItem = Trim(Str(I))
List1.AddItem Space((List1.Width - 350 - TextWidth(sItem)) / TextWidth(" ")) & sItem
Next
End Sub
Assuming the Font for your Form matches the Font for your Listbox.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
[This message has been edited by Aaron Young (edited 12-02-1999).]