Hi,
So, I have a FlowLayoutControl which starts empty but after a button is pressed a control is added to it. When said control is disposed I want something to happen.
Private Sub Panel_ControlContainer_ControlRemoved(sender As Object, e As ControlEventArgs) Handles Panel_ControlContainer.ControlRemoved
If IsChanging = False Then
If Panel_ControlContainer.Controls.Count = 0 Then
If Width < 500 Then
Panel_ControlContainer.Visible = False
NavigationBar1.Dock = DockStyle.FillEnd If
End If
End If
End Sub
This example is what I’m testing for in code when a control is removed. There can only be 1 control in the “Panel_ControlContainer”. The problem is that Panel_ControlContainer.Controls.Count returns > 0 eventhough a control was removed (the only control).
Could it be that this event is triggered before the control is actually removed?
(I add a new control to Panel_ControlContainer.controls at runtime when a user clicks a NavigationBarItem)
If needed I can provide (partially) the source
Thanks in advance!
Vincent
Cannot reproduce. I get the correct count in ControlAdded and ControlRemoved events.
Hi Vincent,
can you please share the code? You can also send it to supportATwisej.com if you prefer.
Thanks in advance,
Frank
Please login first to submit.