Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.02 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids;
  8.  
  9. type
  10.     TPerson = record
  11.         Name: string;
  12.         Age: Integer;
  13.     end;
  14.  
  15.  
  16.   TForm1 = class(TForm)
  17.     StringGrid1: TStringGrid;
  18.     procedure FormCreate(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.dfm}
  31.  
  32. procedure TForm1.FormCreate(Sender: TObject);
  33. var
  34.     People: array[1..3] of TPerson;
  35.     I: Integer;
  36. begin
  37.     People[1].Name := 'Denis';
  38.     People[1].Age := 228;
  39.  
  40.     People[2].Name := 'Anya';
  41.     People[2].Age := 1337;
  42.  
  43.     People[3].Name := 'Liza';
  44.     People[3].Age := 1488;
  45.  
  46.     for I := 1 to 3 do
  47.     begin
  48.         StringGrid1.Cells[0, I - 1] := People[I].Name;
  49.         StringGrid1.Cells[1, I - 1] := IntToStr(People[I].Age);
  50.     end;
  51. //    StringGrid1.Cells[1, 0] := 'Hello';
  52. end;
  53.  
  54. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement