Implementing public interface of another class 
Author Message
 Implementing public interface of another class

I want to create few usercontrols but each must implement public methods
and properties form the basecontrol and the basecontrol must subclass few
messages of all vbcontrols placed on usercontrol.

To do this I was try following ways:

First I prepared interface class (basecontrol class) and implemented it in
usercontrol but the
problem is that I must write implementation for each public property or
method at
usercontrol code level. I wont to do this way. It is possible to acces
public properties and
methods of interface class without implemetation? But i need that these
properties and methods
must be public in usercontrol too! It would be great, if i may derive
usercontrol from basecontrol class!

Another problem is when i prepared class (basecontrol class) which have some
public properties and methods
and instantiate the basecontrol class as the helper class of usercontrol, i
need to pass
usercontrol reference to the basecontrol class for example to
basecontrol.init method because
in the basecontrol i need handles(hwnds) to each vbcontrol placed on
usercontrol (for subclassing).
But i can't declare init method as following basecontrol.init(userctrl as
object) and pass usercontrol reference as Me,
because it raises an runtime error of different type. Similar i can't use
type as control or usercontrol because it raises designtime error
that these types can't be used as arguments in public methods.

Any help on this matter would be greatly appreciated.
Thanks in advance!

Daniel



Mon, 22 Mar 2004 18:12:01 GMT  
 Implementing public interface of another class
In the user control, just declare your class as public, for example;
This is my Class -> MyClass.cls (MyClass)
This is my UserControl - UserControl1.ctl (MyControl)
'User Control Code
Public MySameClass as MyClass

Now that class is your user controls object that anyone using your user
control can access...

Tezcan


Quote:
> I want to create few usercontrols but each must implement public methods
> and properties form the basecontrol and the basecontrol must subclass few
> messages of all vbcontrols placed on usercontrol.

> To do this I was try following ways:

> First I prepared interface class (basecontrol class) and implemented it in
> usercontrol but the
> problem is that I must write implementation for each public property or
> method at
> usercontrol code level. I wont to do this way. It is possible to acces
> public properties and
> methods of interface class without implemetation? But i need that these
> properties and methods
> must be public in usercontrol too! It would be great, if i may derive
> usercontrol from basecontrol class!

> Another problem is when i prepared class (basecontrol class) which have
some
> public properties and methods
> and instantiate the basecontrol class as the helper class of usercontrol,
i
> need to pass
> usercontrol reference to the basecontrol class for example to
> basecontrol.init method because
> in the basecontrol i need handles(hwnds) to each vbcontrol placed on
> usercontrol (for subclassing).
> But i can't declare init method as following basecontrol.init(userctrl as
> object) and pass usercontrol reference as Me,
> because it raises an runtime error of different type. Similar i can't use
> type as control or usercontrol because it raises designtime error
> that these types can't be used as arguments in public methods.

> Any help on this matter would be greatly appreciated.
> Thanks in advance!

> Daniel



Fri, 26 Mar 2004 05:07:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Implementing IUnknown interface in Access 2000 class

2. Implementing the IEnumerator interface in my custom class

3. Which classes implement an interface?

4. Need help Implement a class interface.

5. Identifying classes/components that implements certain interfaces

6. IMPLEMENTING AN INTERFACE MADE FROM ANOTHER INTERFACE

7. Implementing an interface made from another interface

8. IMPLEMENTING AN INTERFACE MADE FROM ANOTHER INTERFACE

9. Implementing an interface made from another interface

10. Public Method in a class calling a private method in same class yields ByRef error

11. Using a UDT in a Class method, how to make a class module public

12. How can I check if a late-bound class implements an Interface or inherits a defined class

 

 
Powered by phpBB® Forum Software