Solved

DBGrid Cells

Posted on 1997-11-28
3
829 Views
Last Modified: 2010-08-05
How to get the data of ONE cell of one DBGrid, to check in a table if this data already exists?
0
Comment
Question by:oberdan
3 Comments
 
LVL 4

Expert Comment

by:itamar
ID: 1352322
Please, could you elaborate the question a bit more. Give an example or more details
Thanks...
0
 
LVL 3

Accepted Solution

by:
Matvey earned 100 total points
ID: 1352323
I think that you can access the DBGrid cells
only from it's Fields property.
And if you want to check the new value that the user
enters in the current cell then you can use the
OnSetText Event of the TField Component.
This event is triggered befor the new field value
is posted into the edited table, so you can change,
format or discard the changes.
See help for details.         Good luck!
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352324
As itamar I don't fully understand the question, but here is a suggestion :

How to get data of one cell?

Well to get data from one cell you need to know which row and which column is selected :

 1. Row    : is the active record of the table
 2. Column : is the selected field of the dbgrid.

To get that value :

 CellString = Table1.GetFieldByName(dbGrid1.SelectedField.FieldName).AsString

or CellValue =

Table1.GetFieldByName(dbGrid1.SelectedField.FieldName).AsInteger

or ... depending on what type of field. You can check this with
 FIELDTYPE property of TField.

Having this data you can check in another table if it already exists with the normal search routines.

Have fun,
c.u. ZifNab;
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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