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

C# - Forcing column in DataGridView to stay at specified width

Hi guys 'n gals,

Is it at all possible to force a column in a DataGridView to stay at a certain width, so that the user cannot manually resize it? If so, what code do I need to do this?


Cheers!
0
Cyber-Drugs
Asked:
Cyber-Drugs
  • 2
1 Solution
 
CBeach1980Commented:
To keep the user from being able to resize it:
DataGridView.AllowUserToResizeColumns = false;

To set the width to a particular size:
DataGridView.Columns["TargetColumn"].Width = 100;
0
 
Cyber-DrugsAuthor Commented:
Brilliant, wasn't sure if I could do that for a specific column or if it would have to be the entire DataGridView, thanks once again!
0
 
CBeach1980Commented:
Again you are more than welcome.  Glad to be of help.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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