Changing DataGrid Column headings

  • Thread starter Thread starter Mac via DotNetMonster.com
  • Start date Start date
M

Mac via DotNetMonster.com

I am attempting to change the header text on all the columns in my datagrid
once it was been populated from a dataset. I have tried to implement some
code from the following MSDN document but what I get is all my columns
having the same values and header text as the last column I added to
DataGridTableStyle I was creating.

Can anyone assist?

Here is the link:
http://msdn.microsoft.com/vbasic/using/building/windows/datagrid/default.aspx?
pull=/library/en-us/dnwinforms/html/wnf_CustDataGrid.asp


regards,

Mac
 
Hi,

If the mappingname for the tablestyle is wrong the tablestyle will have
no effect. Try using the dataset.table(0).tablename for the tablestyles
mapping name

Ken
 
Thanks for replying Ken.


I currently have tablestyle.mappingname = "Policies" and the name of the
datatable bound to the datagrid is the same name.

Is this correct?
 
Don't bother - I got it working. Looks like the code was incorrect.

Each column I was adding to the tablestyle used the same variable, which is
obviously why when it came time to update the datagrid with the style it
used the last update value, which was the last column.

To resolve I created a separate variable for each column and that did the
trick!
 
Mac,

It is a standard problem. You did probably not create every column as a
"New" column and now you did that automatic with giving them all another
name.

To give you an answer on the "why".

I hope this helps,

Cor
 
Back
Top