Microsoft KB Archive/149274

= FIX: SSTab Is Locked When on Modal Form Shown at Load Time =

Article ID: 149274

Article Last Modified on 3/14/2005

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q149274



SYMPTOMS
Showing a modal form in the Form_Load event of a different form causes any SSTab controls on the modal form to ignore all mouse and keyboard commands. This problem occurs with both the 16-bit and 32-bit SSTab OCXs.



RESOLUTION
This problem occurs only when the tab control is on a form that is shown modally during the load event of another form. To avoid this problem, either show the form non-modally, or show the form modally, but in an event other than the Form_Load event of the first form. Alternatively, one can emulate the appearance of showing the second form modally using a scheme similar to the one outlined below, although any code placed in the Form_Load event will be executed because execution will not pause when the second form is shown. This should be taken into account if code is written using this method. The following code fragment makes the first form invisible and then shows the second form. When the second form is unloaded, one line of code in the Unload event of the second form makes the first form visible again.

Sample Code

' On Form1 Private Sub Form_Load

Form1.Visible = False Form2.Show

End Sub

' On Form2 Private Sub Form_Unload

Form1.Visible = True

End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Basic 5.0.



Steps to Reproduce Behavior
 Start Visual Basic 4.0. Form1 is created by default. Add a second form to the project by selecting Form from the Insert menu. Add a single SSTab to Form2. Leave all properties as default.  Add this code to the Form_Load event of Form1:

Private Sub Form_Load Form2.Show vbModal End Sub  Press F5 or select Start from the Run menu to start the application. Form2 displays, but the tab control does not respond to any mouse or keyboard commands.</ol>

<div class="references_section">