DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth DataGridViewColumn.MinimumWidth Property


Gets or sets the minimum width, in pixels, of the column.

 property int MinimumWidth { int get(); void set(int value); };
public int MinimumWidth { get; set; }
member this.MinimumWidth : int with get, set
Public Property MinimumWidth As Integer

Property Value

The number of pixels, from 2 to MaxValue, that specifies the minimum width of the column. The default is 5.



The following code example sets the minimum width of a column. This code example is part of a larger example provided for the DataGridViewColumn class.

//Set the minimum width.
void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   DataGridViewColumn^ column = dataGridView->Columns[ 1 ];
   column->MinimumWidth = 40;

//Set the minimum width.
private void Button4_Click(object sender,
    System.EventArgs e)
    DataGridViewColumn column = dataGridView.Columns[1];
    column.MinimumWidth = 40;
'Set the minimum width.
Private Sub Button4_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button4.Click

    Dim column As DataGridViewColumn = dataGridView.Columns(1)
    column.MinimumWidth = 40
End Sub


The MinimumWidth property sets a limit on how narrow the column can be resized in the user interface (UI). The Width property can override the MinimumWidth property.

Applies to

See also