Given
Dim cb As CheckBox = New CheckBox
AddHandler cb, AddressOf cb_CheckChanged
cb.Checked = True
...aside from disabling the control, how can I prevent the assignment to Checked from raising the CheckChanged event? I grew up in MFC and events only got raised when the U S E R changed the control's state. What was Softy was thinking? Is it really impossible to distinguish between an event from the user and an event from my own assignment statement? Yikes!
it is perfectly valid to raise the event regardless of the thing causing the event because the
CheckChanged
event just tells you when theChecked
property has changed.If you are trying to avoid the infinite loop you must be experiencing try adding a conditional: