Datagrid Column Width

G

Guest

I found the following code on microsoft.support.com which is supposed to with of a column
'----------------------------------------------
Dim ts As New DataGridTableStyle(
ts.MappingName = "tbl_Client
DataGrid1.TableStyles.Clear(
DataGrid1.TableStyles.Add(ts
DataGrid1.TableStyles("tbl_Client").GridColumnStyles("First_Name").Width = 17
'--------------------------------------------------------------------------------------
Where tbl_Client is the Table name and First_Name is the column Name
But when I run the code I get the following error

Object reference not set to an instance of an objec

Thanks for your hel
 
M

Miha Markic [MVP C#]

Hi Heinz,

I think that there is no First_Name column style.
You should probably add it to ts.
 

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

Top