Home > DeveloperSection > Forums > How to Auto-size cell in datagridview according to data size
Ankit Singh

Total Post:341

Posted on    September-04-2013 1:41 AM

 C# C# 

 1 Reply(s)
 1403  View(s)
Rate this:

I searched for Autosizing of cell but found Auto-size row and column how can I make particular cell autosize (in terms of height since column width will be fixed)according to data size of that particular cell? can it be done using some property of datagridview?

Sumit Kesarwani

Total Post:378

Posted on    September-04-2013 3:29 AM

Hi Ankit,

You can handle it through properties of DataGridView, Set the following properties. Setting follwing properties will allow the cell to expand (Vertically or horizontally) to show the full content without any truncation. These cell size expansion will result in either row or column size change where the cell exisit.

AutoSizeRowsMode = AllCells

AutoSizeColumnsMode = DisplayedCells

Don't want to miss updates? Please click the below button!

Follow MindStick