?
Solved

Referring to Dynamically loaded UserControl in VB.NET

Posted on 2009-04-22
3
Medium Priority
?
234 Views
Last Modified: 2012-05-06
if I have this code:

for x = 0 to totalPics
     Me.TabPage2.Controls.Add(New NamesControl.ProductImage)
next

How would I refer the the created control?
0
Comment
Question by:steverguy
  • 2
3 Comments
 
LVL 2

Expert Comment

by:neo00000110
ID: 24207223
hi,

give the control an id when you add it to the tabpage then do.

dim control as NamesControl
control = Me.TabPage2.findcontrol("controlID")
0
 
LVL 2

Accepted Solution

by:
neo00000110 earned 2000 total points
ID: 24207297
sorry i forgot to suggest using the x for the id so

for x = 0 to totalPics
     dim cont as new namescontrol.productimage
     cont.id = "id_" & x.tostring
     Me.TabPage2.Controls.Add(cont)
next

then you'd loop through when referring to it i guess or however you would need to.
0
 
LVL 1

Author Comment

by:steverguy
ID: 24207436
it didn't seem to like cont.id - but i was able to use cont.name.

Thanks for he help!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question