Solved

Sending Grid Column Titles to Clipboard

Posted on 1999-01-09
2
184 Views
Last Modified: 2010-04-04
How do you access the dbgrid column title text to send to the clipboard? I can send the dbgrid contents but not the column headings.
0
Comment
Question by:evansj
[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 1

Accepted Solution

by:
adeng earned 50 total points
ID: 1355505
1. Procedure to copy all DBGrid title to Clipboard :

procedure TForm1.Button1Click(Sender: TObject);
var
     I: Integer;
begin
     with DBGrid1 do
     begin
          I := 0;
          ClipBoard.Clear;
          while I < FieldCount do
          begin
               Clipboard.AsText := Clipboard.AsText +
               Columns[I].Title.CAPTION+ ', ';
               inc(I);
          end;
     end;
end;

2. Procedure to copy DBGrid title of the active cell to Clipboard :

procedure TForm1.Button2Click(Sender: TObject);
begin
     with DBGrid1 do
          Clipboard.AsText := Columns[SelectedIndex].Title.Caption;
end;

0
 

Author Comment

by:evansj
ID: 1355506
I didn't need the code snippet, I just needed the property. Thanks lots.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

719 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