My question is simple, but I can not think of an easy solution. Lets say I have a DataGridViewTextBoxColumn
. How can I make it break text into several lines if it is too long to be shown in one line?
Asked
Active
Viewed 1,408 times
3

Cody Gray - on strike
- 239,200
- 50
- 490
- 574

IordanTanev
- 6,130
- 5
- 40
- 49
2 Answers
4
You need to create a new DataGridViewCellStyle
class with the WrapMode
property set to "True", and assign this to the DefaultCellStyle
property of your DataGridViewTextBoxColumn
.
For example:
DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle();
dgvCellStyle.WrapMode = DataGridViewTriState.True;
myDataGridView.Columns[0].DefaultCellStyle = dgvCellStyle;

Cody Gray - on strike
- 239,200
- 50
- 490
- 574
1
Set the WrapMode
of the DefaultCellStyle
of your DataGridViewTextBoxColumn
to true
.

SwDevMan81
- 48,814
- 22
- 151
- 184