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!
Who is Participating?
Jorge PaulinoIT Pro/DeveloperCommented:
Is this the name or your user control ?
If so you should do:

Dim userControl As New NamesControl.ProductImage 

Open in new window

Jorge PaulinoIT Pro/DeveloperCommented:
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.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Jorge PaulinoIT Pro/DeveloperCommented:
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
Jorge PaulinoIT Pro/DeveloperCommented:
chokka ,
This question doesn't get the attention of the community and you should create a new thread and detail your problem.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.