D
djc
<snippet from .net documentation>
If Panel1.Controls.Contains(NewPanelButton) Then
RemoveHandler NewPanelButton.Click, AddressOf _
NewPanelButton_Click
Panel1.Controls.Remove(NewPanelButton)
NewPanelButton.Dispose()
End If
</snippet from .net documentation>
I need to be able to first check if a control exists within a panel and take
action based on its existence. The above method seems like it would fit the
requirement but I get a compile error "Name nameOfControl is not declared".
It seems this method is meant to see if a control 'contains' another control
so how can it be required for the control name passed in to exist first? The
control I need to check for is dynamically created and thats why I need to
check for its existance in the first place. So it may or may not exist????
????
If Panel1.Controls.Contains(NewPanelButton) Then
RemoveHandler NewPanelButton.Click, AddressOf _
NewPanelButton_Click
Panel1.Controls.Remove(NewPanelButton)
NewPanelButton.Dispose()
End If
</snippet from .net documentation>
I need to be able to first check if a control exists within a panel and take
action based on its existence. The above method seems like it would fit the
requirement but I get a compile error "Name nameOfControl is not declared".
It seems this method is meant to see if a control 'contains' another control
so how can it be required for the control name passed in to exist first? The
control I need to check for is dynamically created and thats why I need to
check for its existance in the first place. So it may or may not exist????
????