How do I cancel rendering of my report at OnNeedDataSource

7 posts, 0 answers
  1. Wadigzon
    Wadigzon avatar
    58 posts
    Member since:
    Feb 2013

    Posted 05 Sep 2013 Link to this post

    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.
  2. Squall
    Squall avatar
    174 posts
    Member since:
    Feb 2011

    Posted 06 Sep 2013 Link to this post

    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
  3. DevCraft banner
  4. Wadigzon
    Wadigzon avatar
    58 posts
    Member since:
    Feb 2013

    Posted 06 Sep 2013 Link to this post

    Ok spawned the exception, now, how do I stop the rendering?
  5. Wadigzon
    Wadigzon avatar
    58 posts
    Member since:
    Feb 2013

    Posted 06 Sep 2013 Link to this post

    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.
  6. Squall
    Squall avatar
    174 posts
    Member since:
    Feb 2011

    Posted 09 Sep 2013 Link to this post

    Do you want to hide the viewer? What do you mean by just not to show nothing?
  7. Mats
    Mats avatar
    10 posts
    Member since:
    Mar 2011

    Posted 09 Sep 2013 Link to this post

    You can set Visible=false on the DetailSection.

    Maybe not the most elegant solution but you can atleast hide the report contents.
  8. Wadigzon
    Wadigzon avatar
    58 posts
    Member since:
    Feb 2013

    Posted 09 Sep 2013 Link to this post

    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.
Back to Top
DevCraft banner