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
3550
Export in background
posted

I thought to use the grid to export dataset to excel from a proccess, and not from a form  .

I mean I want to create a windows service, that binds data to a grid and exports it

to excel, without opening a form.

Is this possible?

The following code, created an empty excel file:

 

grid.DataSource = ds;
grid.Show();
 
grid.Refresh(); 
 string exportFileName = "c:\\X.xls";

ultraGridExcelExporter1.Export(grid, exportFileName);

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    If the grid is not parented to any form, then it will have no BindingContext and it will therefore be unable to get any data.

    Try setting grid.BindingContext to a new BindingContext immediately after you call the grid's Constructor.

Children