Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > DataGridViewColumn
 

DataGridViewColumn

How I can change DataGridViewColumn type programmatically?

Thanks in advance!

JHG JetLane  Tuesday, January 24, 2006 6:14 PM

You can't. The best thing you can do is to create a new column and copy over all the common properties to the new column.

Why do you want to do this?

-mark

DataGridView Program Manager

Microsoft

This post is provided "as-is"

Mark Rideout  Tuesday, January 24, 2006 6:32 PM

It's not going to be easy. Removing a column removes all the data for the column, so you'll have to save off all the data in the column when you insert the new column and then iterate through each row in the new column and reset the new values.

-mark

DataGridView Program Manager

Microsoft

This post is provided "as-is"

Mark Rideout  Tuesday, January 24, 2006 8:06 PM

You can't. The best thing you can do is to create a new column and copy over all the common properties to the new column.

Why do you want to do this?

-mark

DataGridView Program Manager

Microsoft

This post is provided "as-is"

Mark Rideout  Tuesday, January 24, 2006 6:32 PM

 

I sucessfuly build grouping with DataGridView, but am not able to change column type from DataGridViewTextBoxColumn to treeView programatically. I need this because if I can, then am going to able to change group header.

 

JHG JetLane  Tuesday, January 24, 2006 7:21 PM

It's not going to be easy. Removing a column removes all the data for the column, so you'll have to save off all the data in the column when you insert the new column and then iterate through each row in the new column and reset the new values.

-mark

DataGridView Program Manager

Microsoft

This post is provided "as-is"

Mark Rideout  Tuesday, January 24, 2006 8:06 PM

Hi , May youplease review my thread under this link

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4200927&SiteID=1

Thank you

Pr.Wael  Wednesday, December 03, 2008 10:44 AM

You can use google to search for other answers

Custom Search

More Threads

• Inport RTF to Access
• Select a datagrid cell value?
• Bind label to property of collection using BindingSource
• modify connectionstring at runtime
• datagrid
• [C# 2.0]Adding a subtotal row on a datagridview
• executing SQL query in C#
• BindingSource (Filter property)
• Drop Down List "blanking out" first entry
• scroll-bar on a datagrid needs to show most recent item added