Hi robrich,
Thanks for your post.
Yes, the sample code for the article "Host Controls in Windows Forms
DataGridView Cells" is missed in that link. Fortunately, in
forums.microsoft.com, a Microsoft PM has posted up the sample code, you may
get it from the link:
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=66954
For the design-time support issue, yes, Whidbey has complete different
editor for DataGridView. If we use Reflector to view DataGridView.Columns
property, we can see that its default editor is:
System.Windows.Forms.Design.DataGridViewColumnCollectionEditor.
Then, in "public override object EditValue(ITypeDescriptorContext context,
IServiceProvider provider, object value)" of
DataGridViewColumnCollectionEditor class, it just constructs a
DataGridViewColumnCollectionDialog for editing the columns collection.
In DataGridViewColumnCollectionDialog.addButton_Click method(which is
triggered when we clicked the add button on the editor form), designer will
popup another form to add new column, that is: DataGridViewAddColumnDialog
Then, in DataGridViewAddColumnDialog constructor, we should find
PopulateColumnTypesCombo() method calling to be interesting. Yes, actually,
it takes the responsibility for populating the column type combobox.
At last, we see that in PopulateColumnTypesCombo() method, the code below
get a collection of types, which is used for filling the combobox:
service1.GetTypes(DataGridViewAddColumnDialog.dataGridViewColumnType,
false)); //service1 is of type: ITypeDiscoveryService
If we look in the Whidbey MSDN document below for
ITypeDiscoveryService.GetTypes() method:
http://msdn2.microsoft.com/library/ssy78ba2(en-us,vs.80).aspx
We see that:
"If baseType is null, all types are returned. Otherwise, only types derived
from the specified base type are returned. If excludeGlobalTypes is false,
types from all referenced assemblies are checked. Otherwise, only types
from non-Global Assembly Cache (GAC) referenced assemblies are checked."
So, if we add our customized column into the current project, VS.net
design-time will successfully query this and display our column type in the
combobox for user to select(because our customized column is a child type
of DataGridViewAddColumnDialog.dataGridViewColumnType).
I have tried the sample code in
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=66954, the
CalendarColumn will appear in the combobox successfully.
Hope this helps.
============================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
robrich - 12 Aug 2005 17:31 GMT
Jeffrey,
Yes, your comments did help very much. I've stepped in some bad code, and
have to wipe my shoes before I'll be able to get back to this to try it out.
It looks mega-cool though.
Can I add a reference to a class library (.dll) full of columns not in the
GAC and use them in the designer as well?
robrich
"Jeffrey Tan[MSFT]" - 15 Aug 2005 02:58 GMT
Hi robrich,
I am glad my reply can help you.
For your further question, I think you may have some misunderstanding in my
last reply.
As I stated in last reply, VS.net designer query the design-time columns
with the statement below:
service1.GetTypes(DataGridViewAddColumnDialog.dataGridViewColumnType,
false)); //service1 is of type: ITypeDiscoveryService
From MSDN for ITypeDiscoveryService.GetTypes, we can see that:
"If excludeGlobalTypes is false, types from all referenced assemblies are
checked. Otherwise, only types from non-Global Assembly Cache (GAC)
referenced assemblies are checked."
In our situation, "false" is passed as "excludeGlobalTypes" parameter to
ITypeDiscoveryService.GetTypes method. This indicated that VS.net designer
will not check the GAC, while it will only get all the referenced
assemblies. So the answer to your question is: Yes. We can place all the
custom defined column styles in an assembly, then in the DataGridView
project, we can just add this assembly in the project as reference. All
will be OK now.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 22 Aug 2005 09:31 GMT
Hi robrich,
Does my reply resolve your problem? If you still have any concern, please
feel free to tell me, thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Hi robrich,
Does my reply make sense to you? If you have any concern, please feel free
to tell me. Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.