Solved

How can I Copy the content in a cell of dxDBGrid to clipboard?

Posted on 2003-10-24
4
1,207 Views
Last Modified: 2007-12-19
The dxDBGrid is in Browse state,but I want to copy the contents of a cell to clipboard.

How can I do?
0
Comment
Question by:SingBabys
4 Comments
 

Author Comment

by:SingBabys
ID: 9618686
I'm waiting for the answer.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9618959
usual u use directly the dataset which is assigned to the grid for this

a sceleton

implementation
{$R *.DFM}

uses Clipbrd;
var AClipBoard : TClipBoard;

procedure TForm1.Button1Click(Sender: TObject);
begin
  AClipBoard.AsText := Dataset.FieldByName('FieldNameYouWant').AsString;
end;

initialization
  AClipBoard := TClipBoard.Create;
finalization
  AClipBoard.Free;
end.

meikl ;-)
0
 
LVL 4

Accepted Solution

by:
nestorua earned 250 total points
ID: 9619746
HI,
Do the following:
procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
  AClipBoard.AsText:=Column.Field.AsString;
end;
Here AClipBoard is a variable of type TClipBoard
(If you read the previous comment you know how to create and free it).
Sincerely,
Nestorua.
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 9623817
ClipBoard is a global object and doesn't need to be created
about dxDBGrid .. forgot it's methods and properties .. been using cxGrid (ver 4+) since it came out
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

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…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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