BUG: Setting Grid Clip Property to Empty Text Box Causes GPF

Last reviewed: April 30, 1996
Article ID: Q150229
The information in this article applies to:
  • Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit only, for Windows, version 4.0

SYMPTOMS

If the Clip property of the Grid control is set equal to the Text property of an empty Text box, a General Protection Fault occurs.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

The Clip property can be explicitly set to an empty string. If the Text box is empty, set the Clip property of the Grid control to an empty string. If the Text box is not empty, set the Clip property to the Text property. For example, instead of:

   Grid1.Clip = Text1.Text

This problem can be avoided by using:

   If Text1.Text = "" Then
       Grid1.Clip = ""
   Else
       Grid1.Clip = Text1.Text
   EndIf

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Place a Grid Control on Form1.

  3. Place a Command button and a Text box on Form1.

  4. Click the Property window for the Text box and delete the Text property (delete "Text1").

  5. In the Click event of the Command button, place the following code:

       Private Sub Command1_Click()
          Grid1.Clip = Text1.Text
       End Sub
    
    

  6. Run the project by pressing F5. When running this code under Windows NT 3.51, the following error message displays:

    "VB caused a General Protection Fault in module GRID16.OCX at 0001:752D"

To work around this problem, change the code in the Click event of the button to:

   Private Sub Command1_Click()
      If Text1.Text = "" Then
         Grid1.Clip = ""
      Else
         Grid1.Clip = Text1.Text
      EndIf
   End Sub


Additional reference words: 4.00 vb4win vb416 buglist4.00 GPF
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsCus



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.