Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Can i make multi line cell in Datagridview.?? Not all cell only selected cells i want to make multi line. and how can increase the height of datagridiew rows
Posted
Comments
samit kaneriya 29-Oct-13 1:39am    
hi give some sample gridview html code which u want to set multiline
Muhamad Faizan Khan 29-Oct-13 5:09am    
winform please
Muhamad Faizan Khan 29-Oct-13 5:09am    
i tag winform
samit kaneriya 29-Oct-13 5:30am    
ok sorry

1 solution

Firstly make the cells that you are interested in wrappable by setting the default style ...
dataGridView1.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True;

Note I've chosen only the first column here [0]. If you wanted all cells to wrap then use
dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True;

To increase the height of all of the rows automatically ...
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
or if you want to specifically target specific rows then it's
dataGridView1.AutoResizeRow(RowNumber, DataGridViewAutoSizeRowMode.AllCells);
where RowNumber is some integer value. My advice would be to let the control do the resizing though
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900