Help with adding web label to array of web labels

Hello all.

I have a Container object that starts off holding two web labels. Programatically, I would like to add or remove some.

For i As Integer = 2 to FieldCount -1 
  //lblHeader.Append i
Next i

This is the code I have tried and variants of it, but each time I get errors on compile. Can anyone give me an idea how to do it properly?


You just need to create a new instance of the control, then set it’s properties

For i As Integer = 2 to FieldCount -1 Dim l As New lblHeader l.Left = xx l.Caption = rs.Field(i).Name Next i

Thanks Wayne.
What is the rs.field for?

But the control is a “set” of members (array in my mind) of labels. So how is your code adding to the array (member set)?


Rs.field was just to show how to set the caption.

Creating a new member of a control set automatically adds it to the set.

Thank you Wayne,