DXWIN0004: EndUpdate Missing
Severity: Warning
The BeginUpdate
method locks a control and prevents any visual updates to this control, which allows you to apply a large number of changes without triggering excessive redraw commands. After all edits are applied, call the EndUpdate
method to unlock the control.
Example 1
Invalid Code
public void UpdateView(GridView view) {
view.BeginUpdate();
// Update operations
}
Valid Code
public void UpdateView(GridView view) {
view.BeginUpdate();
// Update operations
view.EndUpdate();
}
Example 2
Invalid Code
public void UpdateView(GridView view) {
try {
view.BeginUpdate();
// Update operations
view.EndUpdate(); // Not called if an exception occurs in the code above
}
catch { }
finally { }
}
Valid Code
public void UpdateView(GridView view) {
try {
view.BeginUpdate();
// Update operations
}
catch { }
finally {
view.EndUpdate(); // The EndUpdate method is always reachable
}
}