Hallo Forum,
ich komme wieder mal nicht weiter:
In meiner Form da hats ein Frame und in diesem Frame ist ein StringGrid drin.
Mit TForm1.FormCreate will ich Spalten und Zeilen beschriften und das funktioniert nicht. Nach dem Compilieren (fehlerlos) verabschiedet sich das Programm mit einer Fehlermeldung
"(...)'Access violation at adress 0044CF11 in module 'Project1.exe'. Read of adress 000002C0'.(...)"
Wenn ich das StringGrid direkt auf der Form1 plaziere, läuft alles Reibungslos...
Vielen Dank für Tipps!
Gruss, Anatol
Form1:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Unit2;
type
TForm1 = class(TForm)
Frame21: TFrame2;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Frame21: TFrame2;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var i:Integer;
begin
with StringGrid1 do
begin
Cells[0,0]:='Nr.';
Cells[1,0]:='X';
Cells[2,0]:='Y';
for i:=1 to RowCount-1 do Cells[0,i]:=IntToStr(i);
end;
end;
end.
Frame21:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids;
type
TFrame2 = class(TFrame)
StringGrid1: TStringGrid;
private
{ Private declarations }
public
{ Public declarations }
end;
var
StringGrid1: TStringGrid;
implementation
{$R *.DFM}
end.