dynamically add columns to datagrid

  • Thread starter Thread starter wapsiii
  • Start date Start date
W

wapsiii

I'm unsure how to best approach this challenge:

A stored proc returns a dataset where the last four columns have
dynamic column names [current year - 3], [current year - 2], [current
year - 1] [current year] (ie. Company, [2003], [2004], [2005],
[2006]).

The row values of these last four year columns I could access by their
position. However, I'd like the datagrid's column's HeaderText to
assume the column name of the returned dataset.

How do I do this?
 
Hi,
Good news is that DataGrid will automatically add and modify the column
header at runtime using the changed column header as long as you check the
"create columns automatically at runtime" checkbox on Datagrid's
PropertyBuilder dialog and use a plain (not strongly typed) dataset as its
datasource.
 
Back
Top