Accessing procedures of a class module from another class module 
Author Message
 Accessing procedures of a class module from another class module

Can I access the methods of one class module (clsOut) from another class
module (clsIn) without having to create a variable referene to clsOut (ie.
not having to place a statement "Dim NewClass as New clsOut" in clsIn)?

Thanks,
Jason



Sat, 13 Mar 2004 13:48:43 GMT  
 Accessing procedures of a class module from another class module
You either need a reference created in the clas, or pass in a reference to
it, like this

clsIn
private m_clsCOut

Public Property set COut(inclsOur as clsOut)
    Set m_clsCOut=inclsOut
End Property

FunctionFoo()
    Dim x as Long
    Foo=3.14159 * m_clsCout.circleRadius * 2
End Function

In main form

Dim cIn as clsIn
Dim cOut as clsOut

Set cIn=New clsIn
Set cOut=New clsOut

Set cIn.COut=cOut
msgbox cIn.Foo


Quote:
> Can I access the methods of one class module (clsOut) from another class
> module (clsIn) without having to create a variable referene to clsOut (ie.
> not having to place a statement "Dim NewClass as New clsOut" in clsIn)?

> Thanks,
> Jason



Sat, 13 Mar 2004 16:16:42 GMT  
 Accessing procedures of a class module from another class module
I believe that, if you put clsOut in a DLL project and set its
.Instancing property to 6-GlobalMultiUse, you can use it just by
calling its methods. I've read about this as a way of creating extra
functions that effectively become an extension of VB as long as you
reference the DLL in your projects. I think you only get one instance
of the class this way, although that sounds like what you want. Also
you don't have any way of using its properties. In fact it's basically
just a BAS module (minus variables) wrapped up as a DLL.


Sat, 13 Mar 2004 17:43:34 GMT  
 Accessing procedures of a class module from another class module
Thanks for the replies. They've pretty much told me what I want to know.

Cheers,
Jason


Quote:
> Can I access the methods of one class module (clsOut) from another class
> module (clsIn) without having to create a variable referene to clsOut
(ie.
> not having to place a statement "Dim NewClass as New clsOut" in clsIn)?

> Thanks,
> Jason



Sat, 13 Mar 2004 21:00:48 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Class modules 97 - Refering to array within a custom class module

2. Circular Reference Between Modules when 2 Class Modules Listen to Each others Events

3. Class Module and Module

4. Class Modules & Modules

5. VB Modules/Class Modules

6. class module vs. module

7. modules and class modules

8. Returning the name of a module/class module

9. Modules or Class modules?

10. Q(VB5) : Different between module & class module

11. Q: Code Module vs UserControl (Form, Class) module.

12. Class Module & Module

 

 
Powered by phpBB® Forum Software