Wrox Programmer Forums
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 June 27th, 2004, 04:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

I am not aware of any side-effects that I know of, but I haven't looked into it thorougly. I applied it to the class because in every situation for that property, I was going to use that particular TypeConverter. That's an interesting point; I wonder how existing classes in the .NET framework declare conversions, in reference to the data type or object converters (such as the StringConverter, Int32Converter, CollectionConverter, etc.).

By declaring it this way, it solve the issue of storing object references in the viewstate in the page; for a custom class, where I didn't declare it, I got an error stating that "it required that a TypeConverter be declared or the class be marked Serializable."

Brian
 
Old June 28th, 2004, 02:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The error seems to make sense. The run-time must know how to serialize the class, before it can put the object in view state. And it also seems to make sense that the TypeConverter is used to do that. (Although marking it as <Serializable> will work equally well for classes that only expose simple, serializable, properties).

So, the more I think about it, the more it seems to make sense to apply the attribute at the class level. At first, I considered this attribute to be a design-time issue, so it's better off being applied to the public property of the control. However, issues with loading the values at run-time and serialization make this a run-time issue as well, so I think it's better to apply it to the class, rather than to the property.

I came across another (old) Microsoft article: http://support.microsoft.com/default...b;EN-US;319626 Here they apply the attribute to the class as well. Assuming Microsoft knows what it's doing, I'll stick to that.

Thanks,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Wrecking Ball by Neil Young (Track 9 from the album: Freedom) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
how can clear the screen the screen malli_kv2 BOOK: Beginning Java 2, JDK 5 Edition 4 January 17th, 2009 12:43 AM
Draw on the screen without clearing the screen pu132 Visual Basic 2005 Basics 0 August 25th, 2006 09:03 PM
Screen Size and Java Script srotondo Classic ASP Professional 5 December 20th, 2004 07:24 PM
Size of Screen cinest General .NET 2 October 8th, 2004 03:33 AM
changing text size on screen markhardiman Classic ASP Professional 4 August 31st, 2004 07:01 AM





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