Показать сообщение отдельно
  #1  
Старый 20.05.2009, 16:19
s2h s2h вне форума
Прохожий
 
Регистрация: 20.05.2009
Сообщения: 2
Репутация: 10
По умолчанию Ошибка EAccessViolation

вот этот код заканчивается ошибкой:
Код:
unit iRobot_MainUnit;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;
const
  x = 50;
  y = 50;
  dlinaPlat = 40;
  vysotaPlat = 20;
type
  TPlat = class
    x1,y1:integer;
    t:real;
    constructor Create;
    procedure Period;
  end;
  TForm1 = class(TForm)
    Panel1: TPanel;
    PaintBox1: TPaintBox;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  Plat: TPlat;
implementation
{$R *.dfm}
constructor TPlat.Create;
begin
  x1:=x;
  y1:=y;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Plat.Period;
end;
procedure TPlat.Period;
begin
  t:=t+(Form1.Timer1.Interval)/1000;
end;
end.

вывод ошибки:
Код:
---------------------------
Debugger Exception Notification
---------------------------
Project xxxxx raised exception class EAccessViolation with message 'Access violation at address 00472DB8 in module 'xxxxx'. Read of address 00000010'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

и ссылается на строку t:=t+(Form1.Timer1.Interval)/1000;
помогите, в чем причина, весь день уже бьюсь, хотя брал часть кода из двух разных программ и там работает, вроде все перепроверил - совпадает..
Ответить с цитированием