我的目的是在选择新的单选按钮时清除计算的标签。目前,我正在使用 7 个单独的点击事件调用相同的子过程,如下所示:
' the following 7 subprocedures clear totals boxes if any radio button is changed
Private Sub rbCappuccino_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbCappuccino.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbChocolate_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbChocolate.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbFilled_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbFilled.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbGlazed_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbGlazed.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbNone_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbNone.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbRegular_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbRegular.CheckedChanged
Call ClearLabels()
End Sub
Private Sub rbSugar_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbSugar.CheckedChanged
Call ClearLabels()
End Sub
我很好奇是否有办法整合这些事件,因为它们都调用了完全相同的子过程。任何意见,将不胜感激。谢谢!