BUG: BeforeUpdate Event of the DataGrid Does Not Always Fire (288346)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition for Windows 6.0
- 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 Q288346 SYMPTOMS
The documentation for the BeforeUpdate event of the Visual Basic 6.0 DataGrid control states:
"When the user moves to another row or the Recordset object's Update method is executed, data is moved from the DataGrid control's copy buffer to the Data control's copy buffer and written to the database."
In fact, the BeforeUpdate event does not fire for at least half of the methods by which a user can "move to another row" after editing a DataGrid cell or cells in the current row, as described later in this article.
CAUSE
The DataGrid only fires the BeforeUpdate event when the user moves from one row to another; therefore, the event does not fire if, after editing a row, the user moves off the DataGrid entirely by selecting another object on the form. In addition, if the user changes rows by clicking the Record Selector (the gray left margin), the AfterUpdate event fires first, preventing the firing of the BeforeUpdate event.
RESOLUTION
If the users of the application cannot be constrained to navigate the DataGrid by using one of the methods for which the BeforeUpdate event reliably fires, then another event or another approach must be used to validate entries or to take other action when the user moves from one row to another or moves off the grid.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 6/28/2004 |
---|
Keywords: | kbbug kbDatabase kbDataBinding kbMDACNoSweep kbpending KB288346 |
---|
|