Results 1 to 3 of 3

Thread: dumb question...

  1. #1

    Thread Starter
    Lively Member cargobay69's Avatar
    Join Date
    Nov 2001
    Location
    Kessel Prison Camp
    Posts
    97

    dumb question...

    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:
    Code:
    UserControl.tmrPing.Enabled = False
    or
    Code:
    CompMon.tmrPing.Enabled = False
    Neither option works. Simply, how can reference the objects and properties of the control from within an included module?

    Thanks
    Darrin@CB69
    -----------------------------------------------
    Arrogance kills brain cells
    -----------------------------------------------
    Private Sub Sandwich (big As Byte)
    On Error GoTo Pub

  2. #2
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245
    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:

    VB Code:
    1. Public ctlRef As CompMon

    In the Initialize event of the control:

    VB Code:
    1. 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.
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

  3. #3

    Thread Starter
    Lively Member cargobay69's Avatar
    Join Date
    Nov 2001
    Location
    Kessel Prison Camp
    Posts
    97
    Yay, thank you
    Darrin@CB69
    -----------------------------------------------
    Arrogance kills brain cells
    -----------------------------------------------
    Private Sub Sandwich (big As Byte)
    On Error GoTo Pub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width