Solved

DBGrid Cells

Posted on 1997-11-28
3
819 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

706 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

21 Experts available now in Live!

Get 1:1 Help Now