Created a layout, need to add it to a scrollview many times...

markcrhome

Member
Licensed User
Longtime User
OK,

I have been creating things in code, but decided using designer gives me a chance to see it!

So using the designer I have created a layout file in which I have added a panel and named it pnlCounter(0)

To this I have added the following labels as children
lblTitle(0)
lblLastseen(0)
lblCount(0)

Finally I added an imageview named imgFrame(0)

The reason they are named with (0) is because I need to add several to a scrollview, and each one I add I need to increment, thus pnlCounter(0) then add pnlCounter(1) etc to end of list.

I need to be able to react to click events and also change Text properties of individual labels, eg lblCount(9).Text = "New Title For counter 9"

The problem is I do not know how to add the layout file to the scrollview, and then add it again and again, while changing the controls name

I also set each pnl, lbl etc tag to be the index e.g. pnl(0).Tag = 0, pnl(4).Tag = 4

What I need to do now is add a number of these panelcontrols to a scrollview, but I do not know how to add
 
Top