auto fire of items events on initilization (check/radio buttons)

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

How can you stop the check changed event from fireing during the
initilization of a form? I have about 4 radio and check boxes on the form,
and when the form is initilizing, the one that is marked as checked during
the initilization (when InitializeComponent is called) always fires it's
check changed event, which I don't want it do to.. how can you prevent this?
thanks
 
you want don't view the chacked, you can setting for all radio or check
enable false...

bye
domenico
 
Hi Brian,

I think we all do that with a flag/bool/switch whatever you name that, that
you set at the end of the load form event to true. This is the most wide
solution I've seen in this newsgroups for that.

I hope that helps?

Cor
 
Hi,

There is no way to prevent the event from happening. Here is a
possible work around.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles CheckBox1.CheckedChanged

Static bIgnore As Boolean = True

If Not bIgnore Then

' Your code goes here

Debug.WriteLine("Checked changed")

End If

bIgnore = False

End Sub



Ken
 
that's pretty much my hack i had in place, was hopeing there was a switch i
was missing that did it already :)
 
* "Brian Henry said:
How can you stop the check changed event from fireing during the
initilization of a form? I have about 4 radio and check boxes on the form,
and when the form is initilizing, the one that is marked as checked during
the initilization (when InitializeComponent is called) always fires it's
check changed event, which I don't want it do to.. how can you prevent this?
thanks

Add the handler to the event after changing the state. Have a look at
the 'AddHandler' and 'RemoveHandler' keywords.
 
Back
Top