dynamically add columns to datagrid

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?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top