PRB: DataBound Controls Not Updated with DataEnvironment Using Refresh MethodID: Q216666
|
The DataCombo and DataGrid controls are not refreshed when using the Refresh method. This behavior is exhibited when using the DataEnvironment.
There are several workarounds. One is to use the ADO Data Control instead of the DataEnvironment. Another is to rebind the controls to the DataEnvironment.
The following code rebinds the controls. Replace the code in the Refresh Click event in the Steps to Reproduce Behavior section with the following:
Set DataGrid1.DataSource = DataEnvironment1
Set DataCombo1.DataSource = DataEnvironment1
Set DataCombo1.RowSource = DataEnvironment1
This behavior is by design.
When running an application and then adding or updating data, the user may want to see the changes reflected in the DataCombo. However, when using the DataEnvironment, these changes are not seen without re-binding the control.
' Updates the recordset with the added data.
DataEnvironment1.rscommand1.Requery
' Supposed to Refresh new data in the Datagrid
DataGrid1.Refresh
' Should have updated the Combobox with the new data
DataCombo1.ReFill
DataCombo1.Refresh
For additional information about binding data controls, please see the following article in the Microsoft Knowledge Base:
Q191457 PRB: DataEnvironment Recordset Requery Does Not Refresh Controls
Additional query words:
Keywords : kbDataBinding kbVBp600 kbDataEnv
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 20, 1999