Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2006, 02:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default UITypeEditor and TypeConverter

Trying to achieve complete design-time integration on some controls I have a hard time figuring out how UITypeEditor works together with TypeConverter. I have made a very simple attempt, but not even that will work... On some Component I have put this property...
Code:
        [EditorAttribute(typeof(MyUITypeEditor), typeof(UITypeEditor))]
        [TypeConverterAttribute(typeof(MyTypeConverter))]
        public int Something
        {
            get { return something; }
            set { something = value; }
        }
        private int something = 0;
... where both MyUITypeEditor and MyTypeConverter are my own implementations. I assumed that the value returned from EditValue of the UITypeEditor implementation would go through the TypeConverter before getting assigned to the property, but that is not what I am seeing. How is it supposed to work?

The thing is that the UITypeEditor will return a string in this test implementation and then I need MyTypeConverter to convert it into an integer. Very simple I thought! Please help if you know the answers.

When I try to debug while designing I can in fact see that the converter is called but I still an error message when returning from the EditValue method because of the wrong type, so what I am asking is if the TypeConverter is used on the returned value from EditValue?

Ups... I might add that it is rather a Visual Studio 2005 problem than a C# problem, and it should probably be in another corner of this forum, sorry.

Thanks a lot, Jacob.
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).





Similar Threads
Thread Thread Starter Forum Replies Last Post
Usercontrol, .NET, Combo Box and UITypeEditor buczma VB Components 0 March 24th, 2004 11:32 PM
TypeConverter bmains ASP.NET 1.0 and 1.1 Professional 1 March 17th, 2004 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.