VSView Reporting Edition Reference > VSReport Control > VSReport Properties > DoEvents Property |
Returns or sets whether the control should process Windows messages while rendering reports.
[form!]VSReport.DoEvents[ = {True | False} ]
Setting this property to True (default) allows users to resize forms, click buttons, etc. while reports are being generated. This makes applications more responsive, and is necessary if you want to provide a "Cancel Report" button (otherwise users wouldn't be able to click the button until the report was done). For example:
Private Sub Render_Click()
If vsr.IsBusy Then
Debug.Print "Can't render now, object is busy"
Else
vsr.Render vp
End If
End Sub
Private Sub Cancel_Click()
If vsr.IsBusy Then
Debug.Print "Cancelling Report"
vsr.Cancel = True
Else
Debug.Print "No report to cancel"
End If
End Sub
Note that the code above checks whether the object is busy before starting to render a report. This is necessary because the user could click the "Render" button several times in a row, before the control got a chance to render the whole report. (Calling the Render method while the control is busy would raise an error).
Setting the DoEvents property to True is similar to adding the DoEvents VB statement to loops in your code.
Boolean