Search code examples
c#propertiesdatagridviewautoresize

Adjusting column width of datagridview according to content size


Guys by specifying the column index,It is possible to set the autoresize property of that column. Like,

 gridview.AutoResizeColumn(1);

Is there any way to set this property to the datagridview without having to specify the columns indexes ?


Solution

  • You can use :

    gridview.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);