atlemann

atlemann

  • NA
  • 5
  • 0

How to change column names/headers at run time

Jul 8 2004 6:04 AM
I have a datagrid with a datatable as a datasource. I import data from files into the datatable and show the data in the datagrid. The column names i set to be the values of "Time" data in the file, but when I import a new file and put new values into a new datatable and set the grids datasource to the new table, I only get row headers and no columns??? Why? I set the datasource to be a new table (DataTable newTable = new DataTable()). That is to me an empty table wich I add new columns too. Is there something I can do to the datagrid object to reset it. To add new DataGrid() before adding new datasource does not work. Then absolutely nothing is drawn. I found out that instead of overwriting all the columns, it removes the ones that doesn't have the same name as the new ones. So all the old ones stayes except the ones that doesn't match. That was really annoying! -Atle