BUG: Visual Basic Modal Form Freezes When It Is Called from the Click Event of a DataGrid Control (305101)



The information in this article applies to:

  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP3
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP4
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0 SP5

This article was previously published under Q305101

SYMPTOMS

When you open a Visual Basic form as modal on the Click event of a DataGrid control, if you click on the header section instead of the grid cells, the form freezes. This problem does not occur if you click on the grid cells.

RESOLUTION

To work around this problem, disable the grid on the Click event, and enable the grid on the modal form's Unload event.

STATUS

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

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Standard EXE project in Visual Basic. Create two forms (Form1 and Form2).
  2. From the Project menu, click Components, and select the Microsoft ADO Data Control 6.0 (OLEDB) and Microsoft DataGrid Control 6.0 (OLEDB) check boxes.
  3. Add the following controls to Form1:
    • Microsoft ADO Data Control 6.0 (OLEDB)
    • Microsoft DataGrid Control 6.0 (OLEDB)

  4. Paste the following code into the code window of Form1:
    Private Sub DataGrid1_Click()
        'Me.DataGrid1.Enabled = False
        Form2.Show vbModal
    End Sub
    					
  5. Paste the following code into the code window of Form2:
    Private Sub Form_Unload(Cancel As Integer)
        Form1.DataGrid1.Enabled = True
    End Sub
    					
  6. Run the project, and click on the header of the DataGrid. Notice that the application freezes.
  7. To work around this problem, uncomment the "Me.DataGrid1.Enabled = False" line in the "DataGrid1_Click" event of Form1, and run the project again.

Modification Type:MajorLast Reviewed:6/28/2004
Keywords:kbBug kbpending KB305101