Home All Groups Group Topic Archive Search About

DatagridView Column Headers

Author
25 Aug 2006 10:57 PM
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

Author
25 Aug 2006 11:48 PM
gene kelley
On 25 Aug 2006 15:57:32 -0700, "jer84" <jerber***@gmail.com> wrote:

>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
Author
25 Aug 2006 11:57 PM
pedestrian via DotNetMonster.com
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
Author
26 Aug 2006 12:12 AM
jer84
Thanks Gene,

I can now resize my columns.


pedestrian via DotNetMonster.com wrote:
> 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