Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the DataGridViewCell to automatically word wrap?

Tags:

c#

winforms

The code below which I found on MSN did not worked to automatically word-wrap a cell:

dataGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;  dataGridView.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True; 

Any more answer?

like image 597
LEMUEL ADANE Avatar asked Jan 31 '11 05:01

LEMUEL ADANE


1 Answers

You also need to set DataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells (along with what you have done) for word-wrap to work.

like image 76
VinayC Avatar answered Sep 20 '22 20:09

VinayC