VB.Net DataGridView Last Column

366 views
Skip to first unread message

theamesy

unread,
Jul 10, 2008, 7:00:12 AM7/10/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I have a datagridview with 3 columns.

AllowUserToResizeColumns is set to false.

I am unable to resize the columns as expected, but i CAN resize the
final column!??!

if you turn column header visibilty off, you can still resize the
final column, just put your mouse anywhere down the right edge of the
control and you'll get the cursor.

When the column headers are on you can only resize it by actually
dragging on the column header, but without column headers you can
resize by cliking anywhere along the right edge.

Does anybody no why its doing this? And how to stop it? I have
AllowUserToResizeColumns turned off cause i dont want the user to
resize columns!

Thanks in advance

Andrew Ames
Hhttp://www.crackmycode.co.uk/default.aspx

bbet...@gmail.com

unread,
Jul 11, 2008, 4:00:50 PM7/11/08
to DotNetDe...@googlegroups.com
Set a width property in pixel size so it has something to go on
-----Original Message-----
From: theamesy <and...@needfreelance.co.uk>

Date: Thu, 10 Jul 2008 04:00:12
To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting<DotNetDe...@googlegroups.com>
Subject: [DotNetDevelopment] VB.Net DataGridView Last Column

Cerebrus

unread,
Jul 12, 2008, 1:16:15 AM7/12/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Right edge of the last column would mean that it is actually resizing
the DGV. Am I right ?

theamesy

unread,
Jul 15, 2008, 6:39:56 AM7/15/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
This is a DataGridView on a GridView, i.e. its a windows application,
not asp.net cheers anyway

theamesy

unread,
Jul 15, 2008, 6:39:19 AM7/15/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I'm not sure, i would assume so. but then you would expect a
horizontal scrollbar would you not?

I had some trouble replicating this in a new application but using the
designer code from my existing code i can replicate, this might help:

'
'dgv3
'
Me.dgv3.AllowUserToAddRows = False
Me.dgv3.AllowUserToDeleteRows = False
Me.dgv3.AllowUserToResizeColumns = False
Me.dgv3.AllowUserToResizeRows = False
Me.dgv3.BackgroundColor = System.Drawing.Color.White
Me.dgv3.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.dgv3.CellBorderStyle =
System.Windows.Forms.DataGridViewCellBorderStyle.None
Me.dgv3.ColumnHeadersHeightSizeMode =
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgv3.Columns.AddRange(New
System.Windows.Forms.DataGridViewColumn()
{Me.DataGridViewTextBoxColumn2})
Me.dgv3.Dock = System.Windows.Forms.DockStyle.Fill
Me.dgv3.GridColor = System.Drawing.Color.White
Me.dgv3.Location = New System.Drawing.Point(0, 0)
Me.dgv3.Name = "dgv3"
Me.dgv3.ReadOnly = True
Me.dgv3.RowHeadersVisible = False
DataGridViewCellStyle1.BackColor = System.Drawing.Color.White
DataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black
DataGridViewCellStyle1.SelectionBackColor =
System.Drawing.Color.WhiteSmoke
DataGridViewCellStyle1.SelectionForeColor =
System.Drawing.Color.Black
Me.dgv3.RowsDefaultCellStyle = DataGridViewCellStyle1
Me.dgv3.RowTemplate.Height = 18
Me.dgv3.SelectionMode =
System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgv3.Size = New System.Drawing.Size(462, 266)
Me.dgv3.TabIndex = 4
'
'DataGridViewTextBoxColumn2
'
Me.DataGridViewTextBoxColumn2.HeaderText = "JobsText"
Me.DataGridViewTextBoxColumn2.Name =
"DataGridViewTextBoxColumn2"
Me.DataGridViewTextBoxColumn2.ReadOnly = True
Me.DataGridViewTextBoxColumn2.Resizable =
System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewTextBoxColumn2.SortMode =
System.Windows.Forms.DataGridViewColumnSortMode.NotSortable
Me.DataGridViewTextBoxColumn2.Width = 125

theamesy

unread,
Jul 15, 2008, 6:49:36 AM7/15/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I finally sorted it, its the stupid texbox column has a resizeable
value set to true, idiot, thanks for your time

On 12 Jul, 06:16, Cerebrus <zorg...@sify.com> wrote:

theamesy

unread,
Jul 15, 2008, 6:46:38 AM7/15/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Sorry actually no its not resizing the grid itself, the grid is docked
to fill on the form, and the final column only extends about half way
in to the grid, it is definately the last column that is resizing????

On 12 Jul, 06:16, Cerebrus <zorg...@sify.com> wrote:
Reply all
Reply to author
Forward
0 new messages