Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New in Delphi (easy question)

0 views
Skip to first unread message

David Maître

unread,
Mar 19, 2001, 10:56:12 AM3/19/01
to
Hi,

Being totaly new in Delphi, I have the following problem:

I would like to create my own class (MyClass) and include on it some delphi
Component.

TMyClass = Class (?) file://What should I use for ancestor
DataBase: TDatabase;
DataSource: TDataSource
Table: TTable;
end;

var
MyClass: TMyClass

I instance my variable (MyClass:= TMyCLass.Create(self) ) and then, when I
try to access the DataBase objet, an exception is raise (access violation).

Should I instance DataBase too ? How ?

I'm making this in a unit without a form in it.

Thank you for your help.

David l...@bluewin.ch


Mike Rochette

unread,
Mar 19, 2001, 1:07:55 PM3/19/01
to
On Mon, 19 Mar 2001 15:56:12 -0000, "David Maître" <l...@buewin.ch>
wrote:

>I instance my variable (MyClass:= TMyCLass.Create(self) ) and then, when I
>try to access the DataBase objet, an exception is raise (access violation).
>

overide the create constructor of mycomponent and create those other
components in it.

Constructor.Create(Aowner:tcomponent);override;

Constructor.Create(Aowner:tcomponent);
Begin
Database := Tdatabase.Create(Self);...
End;

Don't forget to destroy all that in the destroy method

0 new messages