Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all


I have a DataGridView in a GroupBox in a winform

This DataGridView has a fix number of 4 rows and 50 columns

The DataGridView is bound to a DataTable.

The 1st column is the sequential number of the row

I want the height of the rows to be resized automatically as i resize the winform

I also want the width of the columns to resize automatically as i resize the winform but here i wish that the 1st column will take only the place it needs and not that the width of all the columns to be the same

Thanks very much!

What I have tried:

I have tried manipulation of the AutoSizeRows/Columns properties
Posted
Updated 20-Mar-18 8:02am
Comments
CHill60 20-Mar-18 12:22pm    
And what did you do when you manipulated teh AutoSizeRows/Columns properties? What happened? Show the code you used.

1 solution

Here is an overview of available options: Sizing Options in the Windows Forms DataGridView Control | Microsoft Docs[^]

Here is a rather dated article that might give you some inspiration: Resizing Data Grid Columns To Content[^]

Or you could try a custom grid like these:
A fast and simple DataGridView analogue[^]
A Much Easier to Use ListView[^]
 
Share this answer
 
v3
Comments
dj4400 21-Mar-18 11:58am    
I have tried the seemingly appropriate combinations from that appear in the 1st article but didnt got the desired result

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