I have code that adds controls to a tab page - and the code below attempts to remove them. All of the labels are removed - but the text boxes and combo boxes are not. I even tried unbinding the text boxes and combo boxes - still not removed.Any help is appreciated - code to remove controls:
Private Sub clearconditiontab()
Dim sftextbox As MicroFour.StrataFrame.UI.Windows.Forms.Textbox
Dim sfcombobox As MicroFour.StrataFrame.UI.Windows.Forms.ComboBox
For Each locontrol As Control In Me.TBP_Condition.Controls
If locontrol.GetType() Is GetType(MicroFour.StrataFrame.UI.Windows.Forms.ComboBox) Then
sfcombobox = locontrol
sfcombobox.BusinessObject = Nothing
sfcombobox.BindingField = Nothing
End If
If locontrol.GetType() Is GetType(MicroFour.StrataFrame.UI.Windows.Forms.Textbox) Then
sftextbox = locontrol
sftextbox.BusinessObject = Nothing
sftextbox.BindingField = Nothing
End If
Me.TBP_Condition.Controls.Remove(locontrol)
Next
Me.TBP_Condition.Refresh()
End Sub