I know how to do it individually but not sure if it's possible to merge into one.
I have 6 containers that contain either Checkbox or RadioButtons.
Struggling sending the type of control and also wondered do i really need to call clear 6 times? Can't VB search each container for a control that can be checked?
vb Code:
#Region "Form Events" Private Sub ClearPizzaCreation(Of t As Control)(ByVal root As Control) For Each ctrl As Control In root.Controls If TypeOf ctrl Is CheckBox OrElse TypeOf ctrl Is RadioButton Then DirectCast(ctrl, t).Checked = False End If Next ctrl End Sub #End Region Private Sub btnStartAgain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _ btnStartAgain.Click ClearPizzaCreation(Of CheckBox)(flpnlToppings) ClearPizzaCreation(flpnlSize) ClearPizzaCreation(flpnlBase) ClearPizzaCreation(flpnlDrink) End Sub




Reply With Quote