BUG:DBGrid with Visible Property Set to False Becomes VisibleLast reviewed: September 17, 1996Article ID: Q139971 |
The information in this article applies to:
SYMPTOMSA DBGrid that has its Visible property set to False does not remain invisible when the data control referenced in its DataSource property is refreshed (via the Refresh method) or has its current record changed.
CAUSEAs a side effect of these methods, a message to repaint is sent to a data bound grid. In this case, the problem is that the DBGrid control does not check its Visible property to see if it is all right to draw itself on the form, it just goes ahead and does it.
WORKAROUNDExecuting the following line of code
<DBGrid Name>.Visible = Falsecauses another Paint message to be sent to the DBGrid control, but this time the grid behaves correctly and hides itself. The workaround is to place this line of code (shown above) in the Reposition event of the data control. Whenever a data control executes a Refresh method, or any of the Move methods, the Reposition event is called, and this line of code causes the correct painting to occur.
Another workaround is to move the DBGrid control off of the visible section of the form when it should not be seen. You can use a line of code such as the following:
DBGrid1.Move -5000, -5000To make the DBGrid visible again, move it back to the correct location on the form.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of the article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to reproduce problem
|
Additional reference words: 4.00 vb4win vb4all buglist4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |