Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to retrieve text from TStringGrid when select it

Posted on 2008-06-22
2
Medium Priority
?
1,255 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

688 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