PDA

Click to See Complete Forum and Search --> : dumb question...


cargobay69
Nov 21st, 2002, 01:37 PM
i am creating a new ocx. It includes the control (CompMon.ctl), a form (frmProperties.frm) and a module (modMain.bas). In the module I have a procedure that needs to change the property of an object in the control file (CompMon.ctl), how do I access / reference the embedded object.
This is what I expected to work:
UserControl.tmrPing.Enabled = False
or
CompMon.tmrPing.Enabled = False
Neither option works. Simply, how can reference the objects and properties of the control from within an included module?

Thanks

Sheppe
Nov 21st, 2002, 02:01 PM
You'll need an object reference in the module. On the initialize of the control have it set the object reference to itself.

Some like:

In the standard module:


Public ctlRef As CompMon


In the Initialize event of the control:


Set ctlRef = Me


Now you should be able to access the control's properties through the object reference. IE: ctlRef.Enabled = True, etc.

See if that works for ya. I don't have a VB6 IDE in front of me to test it for ya.

cargobay69
Nov 21st, 2002, 02:33 PM
Yay, thank you :)