Microsoft KB Archive/232268

= BUG: Validate Event Is Not Fired When Placing a FlexGrid Control on a Tab =

Article ID: 232268

Article Last Modified on 5/13/2003

-

APPLIES TO


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

-



This article was previously published under Q232268



SYMPTOMS
When placing controls on a tab control, the Validate event is fired every time you shift the focus from one control to another, or when changing the visible tab.

If one of the controls placed on the Tab control is a FlexGrid control then the validate events are not fired correctly when moving from one tab to another using the mouse. Although they work fine if shortcuts are used on the tab's captions and the keyboard is used to move between tabs.



RESOLUTION
Use other events such as lost focus to simulate validation.



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



Steps to Reproduce Behavior
 Start a new standard .exe project. Select the Microsoft Flex Grid Control 6.0 and the Microsoft Tabbed Dialog Control 6.0 from the Components List under the Project menu. Place the Microsoft Tabbed Dialog Control on your form. Place two text boxes on a tab. On the same tab place the Microsoft Flex Grid Control. Set the CausesValidation property to True on all controls, including the tab control.</li> Add a text box to the form. Call it txtLog, set Text="" and set multiline to True.</li>  On the Validate event from each control (including the Tab control), write a line to the txtLog control so that you can see when such events are firing as shown below:

Option Explicit

Private Sub MSFlexGrid1_Validate(Cancel As Boolean) txtlog = txtlog & "MSFlexGrid1 Validate" & vbCrLf End Sub

Private Sub SSTab1_Validate(Cancel As Boolean) txtlog = txtlog & "SSTab1 Validate" & vbCrLf End Sub

Private Sub Text1_Validate(Cancel As Boolean) txtlog = txtlog & "Text1 Validate" & vbCrLf End Sub

Private Sub Text2_Validate(Cancel As Boolean) txtlog = txtlog & "Text2 Validate" & vbCrLf End Sub </li>  Change the caption for each tab to: &A, &B, &C So that you can change the visible tab with the keyboard. </li> Save and then run the project.</li> Click on Text1, Text2 and the grid - validate events are being fired as expected. Click tab B. You will notice that no validate event was fired.</li> Return to Tab A and click Text1. Now turn to Tab B using the keyboard (Alt + B). The validate event was fired.</li> Create another project similar to this one, without a FlexGrid, and everything will work as expected.</li></ol>

Keywords: kbbug kbpending KB232268

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.