Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AutoGenerateColumns property missing from the DataGridView

Posted on 2009-05-08
3
Medium Priority
?
824 Views
Last Modified: 2013-12-17
Hi Experts,
Keep a DataGridView from generating columns when it is bound.
I would like to use the AutoGenerateColumns property and set it programmatically to false but it seems to be missing from the DataGridView class.
0
Comment
Question by:tonySchlein
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24339226
Intriguing. I just tried and I can do this:

Does that give an error for you?

DataGridView gv = New DataGridView();
gv.AutoGenerateColumns = false;

Open in new window

0
 

Author Comment

by:tonySchlein
ID: 24354174
I pasted your snippet in and did not get an error.
So it turns out that the problem is simply that the AutoGenerateColumns property did not show up in intellisense and I assumed that it was not present. PBKAC.
Not so intriguing after all. Oh well. Thanks for the help.
0
 
LVL 39

Expert Comment

by:abel
ID: 24354289
you're welcome. Sometimes the intellisense is not what it seems. And sometimes, it even deliberately removes items from the dropdown list of options, for instance the String extension methods are not shown (the ones that act on IEnumerator<string> and are predefined). They did so to prevent cluttering,

Though your situation just seems a minor bug. Try to install all recent fixes including SP1, and see if that helps...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

963 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