Solved

AutoGenerateColumns property missing from the DataGridView

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

816 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