Board index » delphi » DBGrid-Reading cell contents

DBGrid-Reading cell contents

Hi everyone,

I'm trying to select a cell and read the contents into a variable but am
totally stuck.
Any help much appreciated.

Ron
-:-

 

Re:DBGrid-Reading cell contents


Quote
Ron Faulkner wrote:

> Hi everyone,

> I'm trying to select a cell and read the contents into a variable but am
> totally stuck.
> Any help much appreciated.

> Ron
> -:-

I would suggest using the Dataset attached to the grid verses the cells
for evaluation unless it is a formatting issue.

Rkr
--

                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer                       .
. TVisualBasic:=class(None)               .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) home (dot) com    .
-------------------------------------------

Re:DBGrid-Reading cell contents


On Sun, 20 Dec 1998 11:09:33 -0000, "Ron Faulkner"

Quote
<ronfaulk...@abii.freeserve.co.uk> wrote:
>I'm trying to select a cell and read the contents into a variable but am
>totally stuck.
>Any help much appreciated.

The SelectedField property of the TDBGrid provides a reference of type
TField through which the value of the field associated with the currently
selected cell can be accessed. So you could do something like:

  YourStrVar := DBGrid1.SelectedField.AsString;

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "The knowledge of the world is only to
Technical Publications              be acquired in the world, and not in a
INPRISE Corporation                 closet."
http://www.inprise.com/delphi          -- Earl of Chesterfield (1694-1773)

Other Threads