[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Load my Usercontrol into a form, dynamically, and multiple times

I created a usercontrol that displays an image an properties of a specific product.  
After loading product values into an array, I would like to use the array to create instances of the usercontrol on the form, with the array values assinging the usercontrol's properties.

I created a function (i found a referance online) with the following code:
Public Sub CreateControl()      
        Dim userControl As UserControl
        userControl = New NamesControl.ProductImage
        userControl.Location(CurX, CurY)
End Sub

I get the following error:
Property access must assign to the property or use its value.

This is my first userControl, so i could've done somethign wrong while creating it, but my hope was that i'd be able to load the userControl and set it's properties in the above function.

This may be vague - but, any ideas what i'm doing wrong?

Thanks for your help!
  • 4
1 Solution
Is this the name or your user control ?
If so you should do:

Dim userControl As New NamesControl.ProductImage 

Open in new window

Is this the name of your user control
steverguyAuthor Commented:
Thank you!  Sorry I didn't respond sooner, i'm only here 2 times per week.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

No problem!
Glad I could help.
I request some one to help me in UserControls :-

Dynamically adding UserControl - Based on total number of rows returned from stored procedure.

I row returned from storedprocedure is equal to 1 usercontrol.

if 2 rows returned from storedprocedure will be equal to 2 usercontrols .. and so it will be increasing or decreasing based on number of rows returned from storedprocedure
chokka ,
This question doesn't get the attention of the community and you should create a new thread and detail your problem.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now