?
Solved

DBGrid Cells

Posted on 1997-11-28
3
Medium Priority
?
855 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
[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
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 300 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

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 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