Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Displaying DataGridViewColumn-derived classes in the ColumnType property of the Edit Columns dialog box
 

Displaying DataGridViewColumn-derived classes in the ColumnType property of the Edit Columns dialog box

Is there a way todisplay DataGridViewColumn-derived classes in the ColumnType propertyof the Edit Columns dialog box. It would be nice to select my custom column class there raher than having to manually add it in the form_load event handler.

Snickel65  Monday, March 02, 2009 8:39 PM

Hi Snickel65,

The normal way to accomplish this task is create a derived "DataGridViewColumnCollectionEditor" class. But this class is internal, you cannot inherited from it outside its namespace. So we don't recommend you to do that.

Once I have copy the whole source code of DataGridViewColumnCollectionEditor class to my currect project in order to inherite it. But the one of its member is of type "DataGridViewColumnCollectionDialog", its also an internal class. You will find in the DataGridViewColumnCollectionDialog class, there is many element under protect and cannot be accessed.

If you directly inherite from UITypeEditor, you will need to implement the function of DataGridViewColumnCollectionEditor first, it still need to access to DataGridViewColumnCollectionDialog class. So it's quite difficult to accomplish.

You can view the source code of any .Net class with "Reflector".
Download here: http://www.red-gate.com/products/reflector/

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Wednesday, March 04, 2009 4:42 AM

Hi Snickel65,

The normal way to accomplish this task is create a derived "DataGridViewColumnCollectionEditor" class. But this class is internal, you cannot inherited from it outside its namespace. So we don't recommend you to do that.

Once I have copy the whole source code of DataGridViewColumnCollectionEditor class to my currect project in order to inherite it. But the one of its member is of type "DataGridViewColumnCollectionDialog", its also an internal class. You will find in the DataGridViewColumnCollectionDialog class, there is many element under protect and cannot be accessed.

If you directly inherite from UITypeEditor, you will need to implement the function of DataGridViewColumnCollectionEditor first, it still need to access to DataGridViewColumnCollectionDialog class. So it's quite difficult to accomplish.

You can view the source code of any .Net class with "Reflector".
Download here: http://www.red-gate.com/products/reflector/

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Wednesday, March 04, 2009 4:42 AM

You can use google to search for other answers

Custom Search

More Threads

• Concerned about designer stability...
• Hiding Inherited Control's Properties
• Controls change position when form is opened in designer
• UserControl Template not beign updated
• Using MSSQL server at run time for Crystal Reports
• Property grid control type and control pattern
• Custom components incorrect position in 2005.
• MDI Child Form Problem
• Controls are not moving after dropped on the Designer
• Code Snippet: Cleaning Rich Text Files