Solved

How to retrieve text from TStringGrid when select it

Posted on 2008-06-22
2
1,252 Views
Last Modified: 2010-04-21
I have a stringgrid named 'Sg1'

It has 6 columns and many rows depending on data loaded into it.  I need to be able to click any cell in column 0 and have the text returned as a string.
For eg:

Title                        Genre                     Actor(1)                    Actor(2)                  Actor(3)                  Location                    Mad Max                Action                     Mel Gibson               Tina Turner                                              Home

I have the top row fixed and the next row(s) has the data in them.  I need to be able to click on any cell in Col(0) the title column and have delphi return a string of the text that is in that cell.  So if a user clicks on cells[0,5] it will show me/them the text in that cell but if they click on cells[1,5] it will not do anything.  I only need col '0' to be active.

Thanks in advance
0
Comment
Question by:Mark Brady
[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
2 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 100 total points
ID: 21840376
procedure TForm1.StringGrid1Click(Sender: TObject);
begin
  if StringGrid1.Col = 0 then
    Label1.Caption := StringGrid1.Cells[0,StringGrid1.Row];
end;
0
 
LVL 20

Author Closing Comment

by:Mark Brady
ID: 31469522
I can't believe it was that wasy.  Thanks Mokule !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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