PC Review


Reply
Thread Tools Rate Thread

DataGridView column order?

 
 
David Veeneman
Guest
Posts: n/a
 
      24th Jul 2006
I've added an unbound column to a bound DataGridView, and I want the unbound
column to be the last column in the grid. But whenever I recompile, the
unbound column is the first column in the grid.

I'm guessing the problem has to do with the grid's AutoGeneratingColumns
property-- perhaps the bound columns are being autogenerated, which causes
the unbound column to slide to the left.

Is that what is happening? Will "AutoGenerateColumns = false" solve the
problem? where would I put the statement?

Thanks in advance.

--
David Veeneman
Foresight Systems


 
Reply With Quote
 
 
 
 
Dave Sexton
Guest
Posts: n/a
 
      25th Jul 2006
Hi David,

> I'm guessing the problem has to do with the grid's AutoGeneratingColumns property-- perhaps the bound columns are being
> autogenerated, which causes the unbound column to slide to the left.
>
> Is that what is happening?


I believe so.

> Will "AutoGenerateColumns = false" solve the problem?


I don't think so because you'll lose all of your bound columns at runtime, unless this is acceptable.

For each column that is being auto-generated add a column to the DataGridView in the designer just as you would an unbound column,
but set the DataPropertyName for each bound column to the name of the DataColumn to which it is bound. You don't have to modify the
AutoGenerateColumns property if you setup the control like I've suggested. You could, however set AutoGeneratingColumns to false
so that you don't have to explicitly define all of the columns but the columns that are not explicitly defined will not be added at
runtime.

--
Dave Sexton

"David Veeneman" <(E-Mail Removed) (domain is my last name)> wrote in message news:(E-Mail Removed)...
> I've added an unbound column to a bound DataGridView, and I want the unbound column to be the last column in the grid. But
> whenever I recompile, the unbound column is the first column in the grid.
>
> I'm guessing the problem has to do with the grid's AutoGeneratingColumns property-- perhaps the bound columns are being
> autogenerated, which causes the unbound column to slide to the left.
>
> Is that what is happening? Will "AutoGenerateColumns = false" solve the problem? where would I put the statement?
>
> Thanks in advance.
>
> --
> David Veeneman
> Foresight Systems
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridView column order? Peter Duniho Microsoft C# .NET 6 13th Jul 2007 09:14 PM
How to set the column order in a DataGridView control Dwight Johnson Microsoft C# .NET 0 18th Apr 2007 08:22 PM
Datagridview column order bug =?Utf-8?B?RXJpYw==?= Microsoft Dot NET Framework Forms 1 28th Mar 2007 01:59 AM
DataGridView Column Order =?Utf-8?B?RGF2ZSBU?= Microsoft Dot NET Framework Forms 1 22nd Nov 2006 08:20 PM
Winforms datagridview column order John Microsoft Dot NET 1 12th Oct 2006 09:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.