Question DataGridView no resize Columns

TheAmes

New member
Joined
Jul 10, 2008
Messages
2
Programming Experience
1-3
I have found that if i set AllowUserToResizeColumns to False on a DataGridView, they can still resize the last column?

This doesn't seem right to me, does anybody know why this is? Or more importantly how to prevent it?

Thank you very much

Andrew Ames:confused:
 
Weird

ok thanks for the reply, as soon as i read it i went off again to create a test app to prove i'm not going mad, but i'm not able to recreate it.

So what i have done is copied the datagrid from my actual application that has the problem, in to a new application for a test, and it still allows me to resize the last column, so i assume its some combination of properties i am setting on the grid. I hope this helps, i have copuied the designer code for the grid and its 1 column: hopefully uou can use this code to replicate my problem

thanks very much

VB.NET:
        '
        '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
 
Back
Top