Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 374669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:25:41+00:00 2026-05-12T14:25:41+00:00

For an unknown reason, VB6 doesn’t interact the same way with UserControl than other

  • 0

For an unknown reason, VB6 doesn’t interact the same way with UserControl than other object.

I have a class that require to hold a graphical interface, a user control and need to be set to be later used from the get method. I have try many thing like using the special class VBControlExtender but without any success.

Here is what I have so far:

Class that hold variables and the user control:

'...
Private WithEvents m_uGUI As VBControlExtender

Public Property Get GUI() As VBControlExtender
    Set GUI = m_uGUI
End Property

Public Property Set GUI(ByVal uValue As VBControlExtender)
    Set m_uGUI = uValue
End Property
'...

Call of the class that cannot compile:

Set myObject.GUI = new ucMyUserControl

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:25:41+00:00Added an answer on May 12, 2026 at 2:25 pm

    From the help on this error (it mentions ListBox and Form, but the same applies to UserControls):

    The New keyword can only be applied to
    a creatable object… You tried to
    instantiate an Automation object, but
    it was not a creatable object. For
    example, you tried to create a new
    instance of a list box by specifying
    ListBox in a statement like the
    following: [sample code snipped]
    ListBox and Form are class names, not
    specific object names. You can use
    them to specify that a variable will
    be a reference to a certain object
    type… But you can’t use them to
    instantiate the objects themselves in
    a Set statement. You must specify a
    specific object, rather than the
    generic class name, in the Set
    statement:

    What you want to do is make an array of your UserControls and load new ones as you need them. Set the Index property of your UserControl to 0 to make it an array and then use the Load statement to create new instances:

    Load ucMyUserControl(1) 
    Set myObject.GUI = ucMyUserControl(1)
    

    When you need more just specify a new upper bound:

    Load ucMyUserControl(2) 
    Load ucMyUserControl(3)
    ...  
    

    When you’re done with them, unload them:

    Unload ucMyUserControl(3)
    Unload ucMyUserControl(2)
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For an unknown reason, I have 1 page that I can't access by ID
I have a simple yield use case and for some unknown reason the default
I have a groovy script with an unknown number of variables in context at
How could I unpack a tuple of unknown to, say, a list? I have
I saw this reply from Jon on Initialize generic object with unknown type :
For some unknown reason, my rewrite rule does not fire. Can you advise ?
For an unknown reason, the linking step in my C++ app step takes just
For some unknown reason I'm running into a problem when passing a variable to
For some unknown reason HDScanner started a deploy-undeploy infinite loop for my (exploded) application
I am trying to use log4net in a VB.NET app for some unknown reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.