[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Selecting rowitem of dbgrid in delphi

dear friends,
i want to access one item of row in dbgrid.
in deplhi i can access column by writing dbgrid1.column.items[0]..
it will fetch column only.
but i want to access row item for particular column.
how can i do that?

Please help me in this question?

Regards,
Rajkiran.
0
Rajkiran
Asked:
Rajkiran
1 Solution
 
ITugayCommented:
Hi Rajkiran,
ROW property of TDBGrid is not published, so, you can't access it directly.
TDBGrid does not store data row by row, it has different logic.
To access data with specified row number you have to access it in dataset instead of grid. Use .First .Last .Next .Prior methods of dataset to set cursor to desired record number (ROW as you called it).
____
Igor
0
 
RajkiranAuthor Commented:
Thanks a lot igor.


Rajkiran.
0
 
tkalchevCommented:
One solution is to go move your dataset to the appropriate row(record) and then to use dbgrid1.datasource.dataset.fieldbyname('your_field').As???
0
 
RatjeCommented:
type
  TMygrid = class(Tcustomgrid );
  TForm1 = class(TForm)
  etc
  etc


procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
  with TMygrid(DBGrid1) do
   ShowMessage(inttostr(row));
end;

Rat
0
 
RajkiranAuthor Commented:
dear ratje,
thank you for providing solution.
i used this.
it solved my problem.

Regards,
Rajkiran.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now