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
1210
Filling a grid on Windows Form
posted

I want to save a dataset table to an excel file just like the grid exporter. I want to dynamically create the grid without displaying anything and use the grid exporter to export it. The code below runs and there are multiple rows in the dataset with just 1 table. The wg.Refresh(); does not fill the grid. So I am asking how do I get the grid filled with the data. Again, the Grid is not on a form.

 

 

 

 

 

 

 

 

Infragistics.Win.UltraWinGrid.

 

 

UltraGrid wg = new Infragistics.Win.UltraWinGrid.UltraGrid

();

wg.DataSource = dsInput;

wg.DataMember =

 

 

"objTable"

;

wg.Refresh();

 

 

 

UltraGridBand

band = wg.DisplayLayout.Bands[0];

 

 

 

//foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in wg.Rows.Band)

 

 

 

foreach (UltraGridRow row in

wg.Rows)

{

 

 

 

for (int

count = band.Columns.Count - 1; count >= 0; count--)

{

band.Columns[count].PerformAutoResize(Infragistics.Win.UltraWinGrid.

 

 

PerformAutoSizeType

.AllRowsInBand);

}

}

Infragistics.Win.UltraWinGrid.ExcelExport.

 

 

UltraGridExcelExporter ux = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter

();

ux.Export(wg,

 

 

@"c:\rosslrooker.xls"

);

Parents Reply Children
No Data