How to right justify text in a listbox column.

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.
 
T

Tom van Stiphout

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
 
C

cr113

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.
 
T

Tom van Stiphout

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.
 
Joined
Sep 10, 2012
Messages
1
Reaction score
0
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:
 
Joined
Jun 28, 2011
Messages
11
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top