How to right justify text in a listbox column.

  • Thread starter Thread starter cr113
  • Start date Start date
C

cr113

How do I right justify text in a listbox column? I tried padding with
spaces but it just seems to strip them off.
 
On Sat, 6 Mar 2010 10:56:12 -0800 (PST), cr113 <[email protected]>
wrote:

Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP
 
Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP

I also forgot to mention that I'm not using a row source. I'm
populating the table manually. I tried padding with spaces and using a
non-proportional font but that didn't work.
 
The obvious suggestion would be to first add your items to a table.

This would also work:
Me.myList.AddItem ("1;" & Chr$(1) & Space$(30) & "aaa")
Me.myList.AddItem ("2;" & Chr$(1) & Space$(30) & "bbb")

-Tom.
Microsoft Access MVP

Yes you can. Here is an example using the Northwind sample database. I
created a new form with a listbox on it, and set the RowSource to:
SELECT [Customers].[ID], Space$(30-len([Customers].[Company])) &
[Customers].[Company] FROM [Customers];
Then I set the font to a non-proportional one, e.g. Consolas
That's all.

-Tom.
Microsoft Access MVP

I also forgot to mention that I'm not using a row source. I'm
populating the table manually. I tried padding with spaces and using a
non-proportional font but that didn't work.
 
the solution is very very easy
1-make the listbox is combobox by convert to combobox
2-make the combobox allign right
3-convert the combobox to listbox again

i hope that is usefull:thumb:
 
I tried moataz's suggestion but it did not work. I have Office 2010 with SP1

The way I solved it was by doing the following:

Go to File -> options -> Client settings -> General alignment

Change the settings to Text Mode, and it worked for me.

Regards
 
Back
Top