Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Using UltraGridExcelExporter in a Console application
posted

Hi,

I've got UltraGridExcelExporter working in my WinForms app. I need to make a console app
that mimics the functionality of the WinForms app. Me being a lazy programmer, is there any
way I can leverage the UltraGridExcelExporter in my console app?

(I guess I could create and bind the UltraGrid, then export it, but my guess is it won't work without me making the form visible)

Thanks,

Amit

 

  • 469350
    Suggested Answer
    Offline posted

    Hi Amit,

    amitbar said:
    I guess I could create and bind the UltraGrid, then export it, but my guess is it won't work without me making the form visible

    The grid doesn't have to be visible, or even on a form. But putting the grid on a form gives it a BindingContext and it won't have one if you don't put it on a form. It also went get disposed automatically.

    So if you create a grid control in code, just make sure that you set it's BindingContext to the BindingContext of a form (any form will do, if you happen to have one) or just set it to a new BindingContext.

    And make sure that you dispose the grid when you are done with it.