Microsoft KB Archive/192089

= BUG: Setting OptionButton Value to True Sets TabStop to True =

Article ID: 192089

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q192089



SYMPTOMS
Setting the Value property of an OptionButton equal to True, either by setting it through code or clicking the radio button, the TabStop property is also set to True.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. Add a CommandButton and an OptionButton to Form1.  Add the following code to the form module: Sub Form_Load Option1.TabStop = False End Sub

Sub Form_Click Option1.Value = True Debug.Print Option1.TabStop End Sub

 Save the project and run it. Press the TAB key and note that you cannot tab between controls. Now click on the Form, which will set the Value property of the OptionButton equal to True. The same behavior will occur if the OptionButton is clicked with the mouse.</li> Press the TAB key again. Note this time that you are able to tab to the OptionButton. This occurs because setting the Value property to True sets the TabStop property to True.</li>  To work around this bug, reset the TabStop property equal to False after the Value property is set to True. In design-mode, modify the Form Click event to look similar to the following: Sub Form_Click Option1.Value = True Option1.TabStop = False Debug.Print Option1.TabStop End Sub

</li> Repeat steps 4-7, and note that the OptionButton is never in the tabbing sequence.</li></ol>

<div class="references_section">