DatagridView Column Headers

  • Thread starter Thread starter jer84
  • Start date Start date
J

jer84

Hi

I've been looking through the properties and I can't seem to find a way
to adjust the column width. Is there a way to do this?

Also, when the datagridview is displaying data, there is a "column" on
the far left used to select records. Is there any way to remove this
column? Or change it's width to something smaller (like zero)?

I appreciate your help very much.

Thanks

Jer
 
Hi

I've been looking through the properties and I can't seem to find a way
to adjust the column width. Is there a way to do this?

You have to have some columns first before you can set a column width. If you added columns in
Design, then you could have set the column width in the column's width property.
Also, when the datagridview is displaying data, there is a "column" on
the far left used to select records. Is there any way to remove this
column? Or change it's width to something smaller (like zero)?

You must have missed the RowHeadersVisible Property while you were looking through the
DataGridView's property window.

Gene
 
Perhaps you can use the RowHeadersWidth properties, eg:

'RowHeadersWidth minimum is 4
DataGridView1.RowHeadersWidth = 4

'Then for your data column, try this (20 to give space to vertical scrollbar
if it exists...
DataGridView1.Columns(0).Width = DataGridView1.Width - DataGridView1.
RowHeadersWidth - 20

HTH.

--
Regards,
Pedestrian, Penang.

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200608/1
 
Thanks Gene,

I can now resize my columns.

Perhaps you can use the RowHeadersWidth properties, eg:

'RowHeadersWidth minimum is 4
DataGridView1.RowHeadersWidth = 4

'Then for your data column, try this (20 to give space to vertical scrollbar
if it exists...
DataGridView1.Columns(0).Width = DataGridView1.Width - DataGridView1.
RowHeadersWidth - 20

And thanks Pedestrian,

That worked for getting that first row out of the way!

All issues are resolve and very quickly. Thanks again

Jer
 
Back
Top