calling a sub inside a usercontrol from a module 
Author Message
 calling a sub inside a usercontrol from a module

Im working on a ocx, it uses subclass. since you can't call the events from
a standar module so i put a friend sub inside the usercontrol to do the
trick but hte problem is that I can't call the sub from the module, how can
I do this?

thanks



Tue, 22 Aug 2000 03:00:00 GMT  
 calling a sub inside a usercontrol from a module

Friend functions will only allow other modules to call it if it is in the
same project.  Use the Public statement to expose it as a method.

Later,
Tony

Quote:

>Im working on a ocx, it uses subclass. since you can't call the events from
>a standar module so i put a friend sub inside the usercontrol to do the
>trick but hte problem is that I can't call the sub from the module, how can
>I do this?

>thanks



Wed, 23 Aug 2000 03:00:00 GMT  
 calling a sub inside a usercontrol from a module

Declare a public variable in your standard module like this:

Dim MyCtl as MyCtlName 'Replace MyCtlName with whatever your userControl is

Then, in your UserControl_Initialize event, do this:

Set MyCtl = Me

Then, whenever you want to call a function of your usercontrol from your
standard module, just call
MyCtl.MyFunction 'replace MyFunction with whatever the function is

For a great example of a subclass control (no cost) check out
WWW.SOFTCIRCUITS.COM

Good Luck,
Russell Davis

Quote:
>Im working on a ocx, it uses subclass. since you can't call the events from
>a standar module so i put a friend sub inside the usercontrol to do the
>trick but hte problem is that I can't call the sub from the module, how can
>I do this?

>thanks



Wed, 23 Aug 2000 03:00:00 GMT  
 calling a sub inside a usercontrol from a module

thanks, it did the trick

Quote:

>Declare a public variable in your standard module like this:

>Dim MyCtl as MyCtlName 'Replace MyCtlName with whatever your userControl is

>Then, in your UserControl_Initialize event, do this:

>Set MyCtl = Me

>Then, whenever you want to call a function of your usercontrol from your
>standard module, just call
>MyCtl.MyFunction 'replace MyFunction with whatever the function is

>For a great example of a subclass control (no cost) check out
>WWW.SOFTCIRCUITS.COM

>Good Luck,
>Russell Davis

>>Im working on a ocx, it uses subclass. since you can't call the events
from
>>a standar module so i put a friend sub inside the usercontrol to do the
>>trick but hte problem is that I can't call the sub from the module, how
can
>>I do this?

>>thanks



Wed, 23 Aug 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. calling a sub inside a usercontrol from a module

2. calling a sub inside a usercontrol from a module

3. Referencing a UserControl inside a Module

4. Bad Calling Convention error 49 - due to calling a Sub in a .bas module

5. Text File Save Sub -- Can't call from inside a Select Case

6. HOWTO: Call JavaScript function from inside a VBScript Sub

7. Calling a MS-DOS Command inside a Sub

8. Calling a function in a usercontrol from out a module

9. Module Call Function of Usercontrol

10. module sub called from within form

11. Calling a Sub in Another Form vs a Module

12. ??Calling Sub-Menu_Click from Module Level Procedures???

 

 
Powered by phpBB® Forum Software