msksurfer

i'm trying to use the column caption but it didn't work. i'm currently using microsoft visual studio .net 2003. i check the online tutorials and did the same, but the caption never turn up at the datagrid. can anyone advise me on this below is my codes. another issue is that, is it possible to change the colour of columns with using tablestyle

count = Db.Observation;

counter = 1;

year = Db.year;

mth = Db.mth;

DataColumn Quantity;

for(int i=0; i<count; i++)

{

if(mth > 12)

{

year++;

mth = 1;

}

Quantity = new DataColumn(year+" / "+mth, typeof(int));

Quantity.Caption = "Data " + counter;

productTable.Columns.Add(Quantity);

counter++;

mth++;

}



Re: Windows Forms Data Controls and Databinding column caption

Ken Tucker

You have to add a tablestyle to the datagrid to change the header text of a datagrid column

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridtablestyle.aspx