Eric F
Eric F

Reputation: 948

VB .NET - Autosize datagridview row height

Problem Definition

So I am trying to do something that should be very basic; however, I can't seem to make it actually work. I am simply trying to make my datagridview autoresize every row height to the text entered. Am I missing something?

What I have tried

I have read through examples on SO and other sites and they all recommend a similar idea. So to make it simple here is exactly what I have done so far:

  1. I created a new datagridview.
  2. I clicked on columns > Add and use the default name and type (textbox)
  3. I kept the Autosizemode of that column at None and DefaultCellStyle WrapMode to True.
  4. I changed the datagridview's AutoSizeRowsMode = AllCells

From there I build my project and type some data in, but the column simply grows the column width and not the row height:

enter image description here

Am I missing a step somewhere? I purposely put every step I did because I feel like I am just missing something very simple...

Upvotes: 3

Views: 9524

Answers (1)

satham
satham

Reputation: 21

go to the data grid view -->properties --> default cell style-change the wrap setting to true then use the autosizerow property as any mode like allcells or display cellslike

Upvotes: 2

Related Questions