Solved

DBGrid and adding Fields

Posted on 1997-10-24
1
204 Views
Last Modified: 2011-09-20
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
ID: 1348875
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
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.

743 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

16 Experts available now in Live!

Get 1:1 Help Now