Тема: Сортування в TStringGrid
Допоможіть відсортувати за "Дисципліною"!..
unit Unit4;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids;
type
TForm4 = class(TForm)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
uses Unit1;
procedure TForm4.FormActivate(Sender: TObject);
var
i,j:integer;
rec:sesiya;
begin
Form4.StringGrid1.RowCount := Filesize(f)+1;
for i:=1 to Filesize(f) do
begin
seek(f,i-1);
read(f,rec);
Form4.StringGrid1.Cells[0,i]:=rec.group;
Form4.StringGrid1.Cells[1,i]:=rec.subject;
Form4.StringGrid1.Cells[2,i]:=rec.teacher;
Form4.StringGrid1.Cells[3,i]:=DateToStr(rec.data);
end;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[0,0]:='Група';
StringGrid1.Cells[1,0]:='Дисципліна';
StringGrid1.Cells[2,0]:='Викладач';
StringGrid1.Cells[3,0]:='Дата';
end;
end.