Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How do I have the cell text wrap?

By default, text in a DataGridViewTextBoxCell does not wrap. This can be controlled via the WrapMode property on the cell style (e.g. DataGridView.DefaultCellStyle.WrapMode). Set the WrapMode property of a DataGridViewCellStyle to one of the DataGridViewTriState enumeration values.

The following code example uses the DataGridView.DefaultCellStyle property to set the wrap mode for the entire control.

this.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;