Need to maintained a resized value of datagridview column after closing form /open it again

21 Views Asked by At

Need to set a resized value by user of datagridview column such that after closing form on which datagridview control present & open it again so the resized value of column should be the same as set while closing the form.

code i tried: 1]

dataGridView1.Columns[col.Name].DisplayIndex = col.DisplayIndex + 3;
                dataGridView1.Columns[col.Name].Visible = col.Visible;
                  dataGridView1.Columns[col.Name].Width = col.Width;

2]

dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);

3]

 dataGridView1.Columns[col.Name].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            int widthCol = dataGridView1.Columns[col.Name].Width;
            dataGridView1.Columns[col.Name].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            dataGridView1.Columns[col.Name].Width = widthCol;

Properties i tried:

AutoResizeColumns with fill
0

There are 0 best solutions below