We help IT Professionals succeed at work.

want to set column width to the width of the datagridview

168 Views
Last Modified: 2014-11-26
Hello Experts,

I have a datagridview. It populates with the records from the database. There are only four columns. I want the columns to fit into the length of the gridview. I tried AutosizeColumnsMode to 'Fill' but it is not working.

Thank you.
Comment
Watch Question

Top Expert 2011

Commented:
I think that in addition to AutoSizeColumnsMode.Fill, you will also need to do it for all cells.

Something like:

AutosizeColumnsMode.AllCells
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I found the solution by myself.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.