Solved

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

Posted on 2007-04-10
3
424 Views
Last Modified: 2008-02-01
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
Comment
Question by:Cyber-Drugs
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
CBeach1980 earned 500 total points
ID: 18884645
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
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 18884940
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
 
LVL 4

Expert Comment

by:CBeach1980
ID: 18884959
Again you are more than welcome.  Glad to be of help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now