![]() |
Call procedure
Code:
i get the error "Zugriffsverletzung bei Adresse 00C683D7 in Modul 'test.exe'. Lesen von Adresse 00000028."
Unit1
public procedure Add(Sender: Tobject) ...... Procedure TFrom1.ADD(Sender:Tobject); begin .... end; Unit2 Procedure Done(Sender:Tobject); uses unit1; var TTest : TForm1; Procedure TFrom2.Done(Sender:Tobject); begin TTest.Add(Sender); end; i have also tried with TTest,create(nil); but i always get this error message, how can i overcome it? |
AW: Call procedure
You're not getting runtime errors out of nowhere. What did you do? What happens first? Which lines causes the error? You can find it out all yourself by using the built-in debugger.
However, the "Access violation when trying to read 00000028" sounds pretty much like calling an objects method without creating it first. The reference you're using simply does not point to an existing object. |
AW: Call procedure
Create a form like
Delphi-Quellcode:
or
TTest := TForm1.Create(Application);
Delphi-Quellcode:
TTest := TForm1.Create(Nil);
and dont forget to free the Form after using
Delphi-Quellcode:
TTest.Free;
|
AW: Call procedure
There is no need to free a TComponent if you specified an owner on its creation.
|
AW: Call procedure
I have one class
Type TCar = class(Tobject) i would like to add another class TMen inside TCar class, how can i add another class inside a Class? |
AW: Call procedure
Delphi-Quellcode:
Depending on your intention you have to create the "FMyOtherClass"-instance somewhere (e.g. within the constructor of TMyClass) and free it within the destructor to avoid memoryleaks.
type
TMyOtherClass = class (* Fields, Methods, Properties *) end; TMyClass = class private FMyOtherClass: TMyOtherClass; (* More Fields, Methods, Properties *) end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:02 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz