Solved

AutoGenerateColumns property missing from the DataGridView

Posted on 2009-05-08
3
803 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 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

13 Experts available now in Live!

Get 1:1 Help Now