This is a migrated thread and some comments may be shown as answers.

How do I cancel rendering of my report at OnNeedDataSource

6 Answers 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wadigzon
Top achievements
Rank 1
Wadigzon asked on 05 Sep 2013, 11:07 PM
While my program is at void OnNeedDataSource(object sender, EventArgs e)
I discover that my data is insufficient (just very few records to make it).... so how do I cancel the rendering process???.
looks like by just returning from OnNeeDataSource will not do it. I still get some empty rendering.

regards.

6 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 06 Sep 2013, 07:10 AM
You can notify the user about what is happening and stop the processing with exception:
void Report1_NeedDataSource(object sender, EventArgs e)
{
    throw new Exception("Report processing stop prematurely.");
}

SN
0
Wadigzon
Top achievements
Rank 1
answered on 06 Sep 2013, 02:45 PM
Ok spawned the exception, now, how do I stop the rendering?
0
Wadigzon
Top achievements
Rank 1
answered on 06 Sep 2013, 02:49 PM
If I let the program run I will get this (shown in the attachment).

Is there anyway to just not show anything?, that red error message is pretty extreme.
0
Squall
Top achievements
Rank 1
answered on 09 Sep 2013, 07:34 AM
Do you want to hide the viewer? What do you mean by just not to show nothing?
0
Mats
Top achievements
Rank 1
answered on 09 Sep 2013, 08:16 AM
You can set Visible=false on the DetailSection.

Maybe not the most elegant solution but you can atleast hide the report contents.
0
Wadigzon
Top achievements
Rank 1
answered on 09 Sep 2013, 04:38 PM
I guess the visible=false helps.

Even when I think it's not a good idea to let unhandled exceptions floating around, those dialog are a little bothersome because I am running in debug mode for now. Thanks.
Tags
General Discussions
Asked by
Wadigzon
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Wadigzon
Top achievements
Rank 1
Mats
Top achievements
Rank 1
Share this question
or