How can I programatically change the value of an option button without firing the click event for that button?
Printable View
How can I programatically change the value of an option button without firing the click event for that button?
One way to do it is to declare a flag that you set before you "click the button in code". Then in the click_event of the button, check for the flag and don't do anything if it's set. Reset the flag after the end of the click event.
This is not the most elegant solution, but it works.
:):)
Use a public variable to indicate that YOU are changing the value. ("Public gbImChanging as Boolean" - in a .bas module.), and in the click event, make the first lines something like :
'who is changing the value?
If gbImChanging Then
gbImChanging = False
Exit Sub
Else
gbImChanging = False
End If
Have fun......
I was hoping for something more elegant. I had already done something like this stuff hoping for the perfect solution. Don't let me down. Thanks.
Try this.
Code:Option1.Value = True
Megatron, that fires the click event for the option button. I don't want the click event to fire.