Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to align text numerics in grid-column? 1

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi there.

In a view I use c(5) as housenumber.
I am asked to show the content right aligned.
When selecting that option in a grid's column and it's textbox the content moves to the right part of the textbox but than the seemed to be centered.
e.g. contents looksa like:
| 130|
| 5 |

which should be like

| 130|
| 5|

Any suggestion?

KR
-Bart


 
Set Column.Alignment = 1 and set Column.Controlsource = "(alltrim(transform(numfield))"

Bye, Olaf.
 
Hi Olaf,
This perfectly does the trick. But can you please explain how this works as you are not using any formatcode.
I tried the change the view (which is controlsource here)like allt(cField) as cField or val(cField) as cField but all with no good result.
KR
-Bart
 
Well,

Alignment = 1 means right alignment. By the way, transform() should be sufficient, you'd only need alltrim, if the source field was a text field values would differ in the number of right spaces.

If you use the expression within the view you'd need to pad the result or else the field width would depend on the first result record.

Important is the outer parenthesis, as that makes VFP accept it as an expression, without this you'd most likely get an error, but with them, it's an expression accepted as controlsource. It's only readonly this way.

Bye, Olaf.
 
Olaf,
Thanks again and 2nd star for you today!
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top