PRB: Click Event Invoked When Option Button Receives FocusLast reviewed: February 21, 1996Article ID: Q88792 |
The information in this article applies to:
SYMPTOMSWhen an option button or group of option buttons is initially placed on a form in Microsoft Visual Basic for Windows, the buttons will remain unselected until the focus is shifted to one of the option buttons. This can cause unexpected results, because shifting the focus to one of the option buttons will invoke a Click event for that option button.
WORKAROUNDUse either the following methods to work around this feature: In design mode, you must manually set the Value property for one of the option buttons to True. -or- If you have more controls on the form, you can set one of the controls with a tabindex property to 0. Therefore, when switching between forms, the focus will not automatically go to the first button.
STATUSThis behavior is by design.
MORE INFORMATIONIn a group of option buttons, one of the buttons should be selected unless the option buttons apply to only certain selected objects on the current form. In this case, the option buttons, when initially displayed, would not be selected. Visual Basic for Windows will allow option buttons to be placed on a form without selecting any of the option buttons. If you desire to create a group of option buttons with none of them selected, there is no way to prevent a Click event from being invoked when the focus is shifted to one of them. A problem may occur when an unselected option button is first in the tab order. The option button will automatically get selected when the form is shown. In all cases, to prevent the Click event from occurring, in design mode, you must set the Value property of one of the option buttons to True. The following steps demonstrate this feature, as well as a way to work around this feature:
Steps to Reproduce Behavior
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |