BUG: Setting Grid Clip Property to Empty Text Box Causes GPF
ID: Q150229
|
The information in this article applies to:
-
Microsoft Visual Basic Professional and Enterprise Editions, 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.
RESOLUTION
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
STATUS
Microsoft has confirmed this to be an issue in the Microsoft products
listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Problem
- Start a new project in Visual Basic. Form1 is created by default.
- Place a Grid Control on Form1.
- Place a Command button and a Text box on Form1.
- Click the Property window for the Text box and delete the Text
property (delete "Text1").
- In the Click event of the Command button, place the following code:
Private Sub Command1_Click()
Grid1.Clip = Text1.Text
End Sub
- 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 query words:
Keywords : kbVBp400bug
Version : WINDOWS:4.0
Platform : WINDOWS
Issue type : kbbug