VB .NET 2003 Check Box Even Called on Load
I am using VB .NET 2003. The CheckedChanged even is being called when the form loads because it is the default option checked. What is a nice clean way to avoid this? Is there another event I should use? Should I disable until the end of form load? What is a good way to fix this? Thanks.
VB Code:
Private Sub _optFont_0_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles _optFont_0.CheckedChanged
theFontSize = 8.25
End Sub
Re: VB .NET 2003 Check Box Even Called on Load
Noone knows how to use a check box? Lol, this is bad.
Quote:
Originally Posted by rex64
I am using VB .NET 2003. The CheckedChanged even is being called when the form loads because it is the default option checked. What is a nice clean way to avoid this? Is there another event I should use? Should I disable until the end of form load? What is a good way to fix this? Thanks.
VB Code:
Private Sub _optFont_0_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles _optFont_0.CheckedChanged
theFontSize = 8.25
End Sub
Re: VB .NET 2003 Check Box Even Called on Load
It's quite simple. Declare a Boolean variable at the class level to indicate whether the form has been initialised. Set this variable at the end of your Load event handler. Test this variable in your CheckChanged event handler and do nothing if it isn't set.