BeginUpdate method
Use the
BeginUpdate
and EndUpdate
methods to improve the runtime
performance. The two methods are designed for scenarios where multiple objects need to
be updated at runtime on an active display
. By wrapping a sequence of visual
updates within these methods, the display defers rendering until all changes are
complete, significantly reducing unnecessary redraws and improving runtime
performance.There is no need to use the
BeginUpdate
and EndUpdate
methods when updates
are performed within the DisplayLoad
event. The DisplayLoad
event already
includes built‑in optimizations to prevent repeated redraws during initial
rendering.The
BeginUpdate
and EndUpdate
methods are especially beneficial for
intensive runtime operations, including:- Loops that modify multiple objects on an active display
- Batch updates to visibility, text, color, or other visual properties
Example usage
- Updating multiple objects in a loop:Display.BeginUpdate() For i = 1 To 1000 Label(i).Text = "New Value" Next i Display.EndUpdate() ' Single redraw at completion
- Updating multiple objects directly on the display:Me.BeginUpdate Txt1.Visible = True Txt2.Visible = True ' ... Txt10.Visible = True Me.EndUpdate
Result
All visual changes are rendered once, at the end of the update block, rather than being
redrawn repeatedly during execution. This approach improves performance and provides a
smoother visual experience on active displays.
Provide Feedback