Consider a simple VB.Net form with a couple radio buttons and a checkbox.
Each of the radio buttons has a CheckedChanged hanlder setup that performs some action based on the state of the checkbox.
My problem is, when I initialize on the default radiobutton to be checked (from the designer properties window) the CheckedChanged event is fired for that radio button, but the Checkbox hasn't been initialized yet so I either get a null pointer exception or the wrong value is used in the handler. Either way I don't want that handler code to be run unless the user picks a radio button after the form has been loaded.
I currently get arround this by not initializing the radio button, but I need to set that default eventually and the best place is from the designer. I also can but a boolean field that's not set to true until the form is fully loaded and not process the events if that is false, but it's a dirty hack.
What can I do to prevent that handler from running it's code?