|
-
Oct 30th, 2002, 05:57 PM
#1
Thread Starter
Junior Member
Accessing a classes attributes
I have a class with attributes I want other classes to access(clsAll) through property methods. I have 3 other classes(forms) that I want to access the attributes that have been instantiated and given values in clsAll by the first form class. The problem is that the second form class can only access attributes of clsAll by instantiating it again thereby initialising the attributes again and losing the values they already contain.
Help!!!!!!!!!
Thanks
erimus
-
Oct 30th, 2002, 07:04 PM
#2
When you say attributes do you really mean properties?
Or do you mean attrbutes like DefaultEvent, Serializable...?
You need to access the same instance of the class. The best way is to pass it between the forms or make a module level variable that holds it.
-
Oct 31st, 2002, 03:35 AM
#3
Thread Starter
Junior Member
Re: Accessing a classes attributes
Thanks Edneeis for the reply. What I mean by attributes are the values that can be returned by a property get method. I need guidance on how I can access the same instance of clsAll from another class without having to instantiate it again.
Thanks
-
Oct 31st, 2002, 05:09 AM
#4
You can either declare it in a module, or pass it to the form that needs it. This is actually a pretty common question. You might want to try searching for, access a control on another form, or something like that, because you would do this the same way.
-
Nov 4th, 2002, 02:41 AM
#5
Thread Starter
Junior Member
Re: Accessing a classes attributes
Thanks Edneeis. I thought of passing attributes to another form as suggested but this did not look to OO to me. So it occurred to me that overriding the New() method with New(arg1, arg 2, arg3) where arg(n) is the attributes I want passed to another form. This worked a treat, and I am very greatful to you for pointing me in this direction.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|