Example Delphi
Delphi Examples Collection
Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.
Copy Stringgrid Cell’s Content to a Memo
Author: admin | Category: Tips and Tricks
In this Delphi example we will make a simple application where it contain a Stringgrid (TStringGrid), a Button (TButton) and a Memo (TMemo). Button "Copy" used to copy a text string from selection cell in stringgrid. Below is the screenshot fo this application:

and this is the code:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids; type TForm1 = class(TForm) StringGrid1: TStringGrid; Memo1: TMemo; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var str_from_grid:string; begin str_from_grid := StringGrid1.Cells[StringGrid1.Col,StringGrid1.Row]; if Length(str_from_grid) > 1 then Memo1.Lines.Add(str_from_grid) ; end; end.
Tags: Copy, Memo, String, StringGrid
Post Meta
-
Tips and Tricks -
Comments Feed -