Results 1 to 3 of 3

Thread: Using ActiveX in the Property of the class

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    433

    Using ActiveX in the Property of the class

    I made a class which load a image on some ActiveX control.
    Here is the code sneppet.

    Code:
    Private m_leadface As LEAD
    
    Property Let FaceTemplate(ByVal newValue As LEAD)
        m_leadface = newValue
    End Property
    
    Sub LoadFaceImage()
        m_leadface.Load m_imagepath
    End Sub
    Following error occurs at m_leadface = newValue in the FaceTemplate property.
    Object variable or With block variable not set
    LEAD is a ActiveX control.
    May I chane it to Set m_leadface = newValue?
    If use Set keyword, no compile error occurs but I'm not sure if it is correct to use Set keyword inside the property.
    Last edited by jdy0803; Jan 28th, 2015 at 08:04 PM.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,476

    Re: Using ActiveX in the Property of the class

    When assigning objects, use Set vs Let or use both:
    Code:
    Property Let FaceTemplate(ByVal newValue As LEAD)
        Set FaceTemplate = newValue
    End Property
    Property Set FaceTemplate(ByVal newValue As LEAD)
        Set m_leadface = newValue
    End Property
    Now the user can call it with or without using Set, i.e.,
    myClass.FaceTemplate = someObjVariable, or
    Set myClass.FaceTemplate = someObjVariable
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    433

    Re: Using ActiveX in the Property of the class

    Thanks,

    It works fine

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