Deleting dynamic ContainerControls?

I add with the Open Event of a page dynamically ContainerControls.

  for row as integer = 0 to Int_MaxRows
    
    If Listrow(row) Is Nil Then
      Dim Listrow_Container As New ContainerControl_OA_Listnrow
      
      Listrow_Container.EmbedWithin(Self, 0 ,mOffset, Listrow_Container.Width, Listrow_Container.Height)
      mOffset = mOffset + Listrow_Container.Height // + 5
      
      Listrow(row) = Listrow_Container
    End If

...

How can I delete dynamically the Listrow(row) when I don’t need them again?

Ist there something like

Listrow(row).delete

e.g.
Listrow(3).delete

[quote=226329:@Thomas Mueller]I add with the Open Event of a page dynamically ContainerControls.

  for row as integer = 0 to Int_MaxRows
    
    If Listrow(row) Is Nil Then
      Dim Listrow_Container As New ContainerControl_OA_Listnrow
      
      Listrow_Container.EmbedWithin(Self, 0 ,mOffset, Listrow_Container.Width, Listrow_Container.Height)
      mOffset = mOffset + Listrow_Container.Height // + 5
      
      Listrow(row) = Listrow_Container
    End If

...

How can I delete dynamically the Listrow(row) when I don’t need them again?

Ist there something like

Listrow(row).delete

e.g.
Listrow(3).delete[/quote]

Instead of using a DIMed variable as you do with Listrow_Container, make Listrow_Container a ContainerControl_OA_Listnrow array property of your webPage, so you can refer to it later.

Something like

[code] for row as integer = 0 to Int_MaxRows

If Listrow_Container(row) Is Nil Then
 Listrow_Container(row) = New ContainerControl_OA_Listnrow
  
  Listrow_Container.EmbedWithin(Self, 0 ,mOffset, Listrow_Container.Width, Listrow_Container.Height)
  mOffset = mOffset + Listrow_Container.Height // + 5
  
  Listrow(row) = Listrow_Container
End If[/code]

Then you can close them all with something like

for row as integer = 0 to Int_MaxRows Listrow_Container(row).Close next

Off the top of my head, but that is the principle…

Thank you. The magic is the .close :slight_smile: