Solved

DBGrid and adding Fields

Posted on 1997-10-24
1
214 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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