Solved

DBGrid and adding Fields

Posted on 1997-10-24
1
228 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
[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
1 Comment
 
LVL 4

Accepted Solution

by:
itamar earned 200 total points
ID: 1348876
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

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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