Hi Progress2007,
Even if you dock the Panel to fill the form and dock the DataGridView to fill the Panel, the columns' width in the DataGridView won't resize when the user resize the form. You need to handle the SizeChanged event of the DataGridView to resize the width of the columns in it. For example:
void dataGridView1_SizeChanged(object sender, EventArgs e)
{
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
this.dataGridView1.Columns[i].Width = (this.dataGridView1.Width - this.dataGridView1.RowHeadersWidth)/ this.dataGridView1.ColumnCount;
}
}
Hope this helps.
Sincerely,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
end us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.