Solved

AutoGenerateColumns property missing from the DataGridView

Posted on 2009-05-08
3
801 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

12 Experts available now in Live!

Get 1:1 Help Now