• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1684
  • Last Modified:

VB.net RowHeight and Word Wrap


How do I set this for all sells in a DataGridView row. I need to make sure that if I have long text in a cell that it wraps and is all visible
Murray Brown
Murray Brown
1 Solution
1. For wordwrap, you use the wrapmode of the cellstyle, e.g for the entire grid use:
Me.dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True

Open in new window

or you can apply the cellstyle to individual collections of cells, columns, rows etc
Here's a good resource from MSDN on datagridview formating http://msdn.microsoft.com/en-us/library/f9x2790s.aspx
2. For RowHeight, simple call set the height by
Dim row As DataGridViewRow = DataGridView1.Rows(0)
row.Height = 15

Open in new window

I am being evil BuggyCoder

Your first link is for ASP.NET gridview (question is for winforms datagridview)
Your second link is for RadGrid which is a 3rd party control

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now