Solved

dbGRID right justify numeric fields???

Posted on 1998-12-10
6
720 Views
Last Modified: 2010-04-04
How do you make a numeric field in dbGRID right jusftified?
I want all my money to be right jusftified:

  52.34
   1.21
 123.45

not
52.12
125.54
1.21
1
anywobyd know how?
thanks
0
Comment
Question by:waipahu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1350307
hi waipahu,

i wonder, because is a field in a table of typ numeric, then there becomes the rightjustify automatically.

you can adjust the allignment of the colums with the colum-editor, which comes up by doubleclicking the grid, add there all fields (table must be open in this case), select the field you want to modify, in the objectinspector set the allignment you want.

meikl
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 10 total points
ID: 1350308
FieldbyName('something').Alignment:=taRightJustify
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1350309
hi ronit,

fieldbyname is not available in dbgrids

to set it in runtime use

  dbgrid1.fields[indexofthefield].alignment := tarightjustify;

meikl

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:ronit051397
ID: 1350310
Yes, I ment Table1.FieldbyName....
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1350311
well, this works also with table1.fieldbyname...
0
 

Author Comment

by:waipahu
ID: 1350312
Thanks for the help. It works...i just specified it as right justified.
I have another problem...formating the numeric field to display 2 digits after
the decimal point:

22.50 displays as 22.5

Using borland's DBE it will work, however using TOPAZ i dont know how
to format the numeric field as 99.99

anyone have any ideas?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question