Microsoft KB Archive/172537: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 71: | Line 71: | ||
<ol> | <ol> | ||
<li>Start a new project in Visual Basic 4.0.</li> | <li>Start a new project in Visual Basic 4.0.</li> | ||
<li>Choose Custom Controls from the Tools menu. Select | <li>Choose Custom Controls from the Tools menu. Select " Grid Control."</li> | ||
<li>Add one CommandButton (Command1).</li> | <li>Add one CommandButton (Command1).</li> | ||
<li>Add one grid control (Grid1), large enough to show a 5 x 5 grid.</li> | <li>Add one grid control (Grid1), large enough to show a 5 x 5 grid.</li> | ||
Line 96: | Line 96: | ||
Grid1.SelEndRow = 1 | Grid1.SelEndRow = 1 | ||
' Show the clip property contents. | ' Show the clip property contents. | ||
MsgBox | MsgBox "The contents of the clip property: " & Grid1.Clip | ||
' Select a new range of cells. | ' Select a new range of cells. | ||
Grid1.SelStartCol = 2 | Grid1.SelStartCol = 2 | ||
Line 105: | Line 105: | ||
Grid1.Col = 3 | Grid1.Col = 3 | ||
Grid1.Row = 3 | Grid1.Row = 3 | ||
MsgBox | MsgBox "Now clearing last selected cell." | ||
' Set the cell to a null value. | ' Set the cell to a null value. | ||
Grid1.Text = | Grid1.Text = "" | ||
' Show the new contents of the clip property. | ' Show the new contents of the clip property. | ||
MsgBox | MsgBox "NOW Notice the contents of the clip property" & _ | ||
Chr(13) & Chr(10) & | Chr(13) & Chr(10) & "compared to the selected cells: " & _ | ||
Grid1.Clip | Grid1.Clip | ||
End Sub | End Sub |
Revision as of 11:06, 21 July 2020
Article ID: 172537
Article Last Modified on 6/28/2004
APPLIES TO
- Microsoft Visual Basic 5.0 Control Creation Edition
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- 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 Q172537
SYMPTOMS
Under most circumstances, the Microsoft Grid control's Clip property will contain only the values of all the currently-selected cells in the grid. However, in Visual Basic 4.0 16-bit, if a cell in a selected range contains a null value, previously selected values will show through in the Clip property at the position of the cell containing a null value. In Visual Basic 4.0 16- and 32-bit, if the last cell in a selected range contains a null value then all previously selected cell values at that position and beyond will be added to the Clip property.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
This behavior does not occur with the newer MSFlexGrid that ships with Microsoft Visual Basic version 5.0.
Steps to Reproduce Behavior
- Start a new project in Visual Basic 4.0.
- Choose Custom Controls from the Tools menu. Select " Grid Control."
- Add one CommandButton (Command1).
- Add one grid control (Grid1), large enough to show a 5 x 5 grid.
Add the following code to Form1:
Option Explicit Private Sub Command1_Click() Dim x as Integer, y as Integer ' Create a 5 by 5 grid. Grid1.Cols = 5 Grid1.Rows = 5 ' Fill the grid with some sample values. For x = 1 To 4 Grid1.Col = x For y = 1 To 4 Grid1.Row = y Grid1.Text = x + y Next y Next x ' Select a range of cells. Grid1.SelStartCol = 1 Grid1.SelStartRow = 1 Grid1.SelEndCol = 4 Grid1.SelEndRow = 1 ' Show the clip property contents. MsgBox "The contents of the clip property: " & Grid1.Clip ' Select a new range of cells. Grid1.SelStartCol = 2 Grid1.SelStartRow = 3 Grid1.SelEndCol = 3 Grid1.SelEndRow = 3 ' Set current cell to the last cell in the selected range. Grid1.Col = 3 Grid1.Row = 3 MsgBox "Now clearing last selected cell." ' Set the cell to a null value. Grid1.Text = "" ' Show the new contents of the clip property. MsgBox "NOW Notice the contents of the clip property" & _ Chr(13) & Chr(10) & "compared to the selected cells: " & _ Grid1.Clip End Sub
- Press the F5 key to run the project.
REFERENCES
For additional information, please see the following article in the Microsoft Knowledge Base:
150229 BUG: Setting Grid Clip Property to Empty Text Box Causes GPF
Additional query words: msgrid grid16.ocx grid32.ocx kbControl kbVBp400bug kbVBp500bug kbVBp kbdsd kbDSupport
Keywords: kbbug KB172537