Solved

DBGrid and adding Fields

Posted on 1997-10-24
1
217 Views
Last Modified: 2010-04-04
Every expert,

How can I add a column (eg. FullName) to the DBGrid that is combine of other fields (eg. FirstName + LastName) in the same DBGrid ??????

By the way, how can I link a DBEdit to a field (eg. FullName) that is combin of other fields (eg. FirstName + LastName) in the Table without adding a field to the Table ??????

Andrew
0
Comment
Question by:andrewyu
1 Comment
 
LVL 4

Accepted Solution

by:
itamar earned 200 total points
Comment Utility
I'll try a step-by-step answer:

1. Double click your TTable or TQuery component;

2. Right click the fields editor area;

3. Choose 'New Field...' option;

4. Type a name for the new field, e.g. "FullName";

5. Choose String for the Type;

6. Check the "Calculated" option for 'Field type';

7. Click OK;

8. Put the following code in the "OnCalcFields" event handler of TQuery or TTable component:
 begin
   FullName.AsString := FirstName.AsString + ' ' + LastName;
 end

9. Now, when you go to the Columns property editor of the DBGrid component, the new field must be available.

10. ADD IT !!

The principle is the same to link the DBEdit. Follow the steps 1 to 8 and then choose the new field (FullName) in the DataField property of DBEdit.

I Hope this can helps.

------S.M.I. (Sory mi inglige ;) -------------


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now