Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2005

Tip: Looking for answers? Try searching our database.

TypeConverter for a UserControl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tlkerns - 10 Aug 2005 16:28 GMT
I am working on a custom DataGridColumnStyle that can host a UserControl.  I
have created a public property on this ColumnStyle of type MyUserControlBase.
I would like to be able to set this property in the PropertyGrid by choosing
from a list of UserControls that inherit from MyUserControlBase.

Using a TypeConverter that inherits from TypeList Converter, I have been
able to get the property to show up in the PropertyGrid and I can even get
the drop-down list to show the list of UserControls.  But when I select one
of them, I get a designtime error of "Invalid property value - Object type
cannot be converted to target type."  I have tried numerous combinations of
overriding CanConvertFrom/ConvertFrom & CanConvertTo/ConvertTo without
success.

Can someone give me a push in the right direction?  Thanks.

Tony
johnvms11 - 10 Aug 2005 17:28 GMT
Are you overriding the 'GetCreateInstanceSupported', 'CreateInstance', and
'ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo
culture, object value, Type destinationType)' methods it your type converter?

If not, it could be that your type converter is not creating the proper
instance type.  

> I am working on a custom DataGridColumnStyle that can host a UserControl.  I
> have created a public property on this ColumnStyle of type MyUserControlBase.
[quoted text clipped - 12 lines]
>
> Tony

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.