UserControl Pointers-VBForums
Results 1 to 3 of 3

Thread: UserControl Pointers

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2014
    Posts
    542

    UserControl Pointers

    I've been using pointers to access my UserControl's properties:

    Using this:

    Code:
    Call vbaObjSetAddref(UC_Object, ObjPtr(Me))

    Allows for this:

    Code:
    UC_Object.ScaleWidth = 100

    But if I have say a PictureBox on the the UserControl, Picture1, I would think this should work:

    Code:
    UC_Object.Picture1.ScaleWidth = 100
    But it doesn't work. Instead I get the following error:

    Code:
    Run-Time error '91':
    
    Object variable or With block variable not set

    Shouldn't this work - or is this just not possible?

    Thanks.

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

    Re: UserControl Pointers

    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
    Hyperactive Member
    Join Date
    May 2011
    Posts
    368

    Re: UserControl Pointers

    As hacky as this looks try `UC_Object.Conrols("Picture1").ScaleWidth = 100`.

    I would expose `Friend Property Get frPicture1() As PictureBox` and work with this instead.

    cheers,
    </wqw>

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.