Header

Hello;

I have a question. I tried to change Column header text of DataGrid with following snippet, but
I doesn't apply. I've used ArrayList Instead of DataTable or DataSet to MappingName Property
and think the error is realated to that;


DataGridTableStyle TS = new DataGridTableStyle();
TS.MappingName = "Categories";// Categories is Filled with anArrayList

CatGrid.TableStyles.Add(TS);
CatGrid.DataSource = Cat.GetCategories();

CatGrid.TableStyles[1].GridColumnStyles[1].HeaderText = "CategoryName";


And then I got this error:
Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index" string

What is the matter? How can I change Header text of DataGrid?
Is it possible without creating DataTable or use DataSet? If so How?

Many Thanks.

[909 byte] By [Ya_aa] at [2007-12-16]
# 1
Numeration in collections DataGridTableStyles, GridColumnStyles ect. is begining from 0, not 1. You have to type:
CatGrid.TableStyles[0].GridColumnStyles[0].HeaderText = "CategoryName";
Skitter at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2

Skitter;

Thanks for your suggestion. But I have been checked the index which you mentioned before and get exactly same error. In addition I should be able to change all of columns header in grid.
I think it is because Mappingname property which fill with arraylist. How can resolve this problem?

I'm glad to see any suggestion of that.
Thanks.

Ya_aa at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...