views:

204

answers:

1

Hello All,

i am using the reportviewer control in a winforms application, with local processing. I want to handle the ReportError event, and if that happens, display a message to user and exit out so i don't have to show subsequent error messages that occur during rendering.

problem is, that even if i do this.close (Close on form that hosts the control), there is no way of canceling the rendering, and it keeps throwing more errors.

Is there a way to cancel report rendering after first exception ?

many thanks

A: 

There is a CancelRendering function that you could try using. It is part of the ReportViewer class.

ReportViewer1.CancelRendering([int time in milliseconds])

It will take a few seconds for the rendering to actually stop though. You could specify a very large time interval in the Function parameter to give it time to cancel.

Jon