473,326 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

TypeConverter Problems

Hi all,

Apologies for the cross-post but I can't determine if this is a VS .NET
problem or a VB.NET language issue. I'm using .NET 1.1 SP1, VS 2003 EA,
VB.NET.

I'm coding a custom component which is designed to be dropped onto a form
and have it's properties manipulated at runtime. I have a custom
implementation of the TypeConverter class called UniversalTypeConverter
which inherits from ExpandableObjectConverter, and for the most part this is
serializing my properties to code without problem, except for a minor quirk.

In simple terms, my Class hierarchy is as follows:

MyComponent
|_ Collection (Strongly Typed Implementation of Class A)
|_ Item (Class A)
|_ Read/Write Property (Class B)
|_ Collection (Strongly Typed Implementation of Class C)

My problem is that with the class hierarchy layed out as above, VS does NOT
serialize the items in the collection of Class C (collection is a property
of Class B) to my code. I can add them using the property editor in VS no
problem, but when I go back to the collection, it's empty (this happens even
if I don't rebuild/save the project in between). Class A, Class B, and
Class C are all attributed with my UniversalTypeConverter, which is geared
up to handle each of them.

I know this sounds like I'm doing something wrong with my TypeConverter, but
I've tested it separately on each of these classes and it works fine. For
example, when I add a test property to my component as below....

MyComponent
|_ Test Property (Class A) {tested as ReadOnly and Read/Write}
|_ Read/Write Property (Class B)
|_ Collection (Strongly Typed Implementation of Class C)

....and I add items to the Class C collection on the above test property, VS
works perfectly. Equally, I had to set it up as follows as a workaround,
which works perfectly...

MyComponent
|_ Collection (Strongly Typed Implementation of Class A)
|_ Item (Class A)
|_ Collection (Strongly Typed Implementation of Class C) -->
Points to Class A's private variable of type Class B

So essentially, in Class A, instead of...

Public Property MyClassB As ClassB
....get/set...
End Property
(doesn't work)

I have the following...

Public Readonly Property MyClassCs
Get
Returns m_MyClassB.MyClassCCollection
End Get
End Property

Which works fine with VS, it's able to serialize the items in the collection
no problem.

Let me clear up the obvious: DesignerSerializationVisibility(Content) has
been attributed to properties where applicable. I've tried my TypeConverter
with constructors that both are and are not full descriptors of the object
instance, I've tried removing properties and restructuring them in my Class
C, but none of it has had any effect.

I've even attached another instance of VS to the first in order to debug it
and step through the code generation. It correctly identifies items in the
collection when it comes to serialize it out to code. It just doesn't seem
to want to do it. No exceptions are thrown (I had it trapping all .NET
exceptions, even those that were handled).

So my question is, is there some limit as to the "depth" that VS's code
generator can go when serializing component properties to code? I've just
proven to myself that the only way my component can work is to make the
collection property one step "shallower", ie move it up a level in my class
hierarchy. Then VS generates the code flawlessly.

Can someone from MS please confirm/deny this?

Many thanks,

Alex Clark


Nov 21 '05 #1
0 1163

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Morris | last post by:
Hi all I created Collection + CollectionItem classes and a TypeConverter in order to persist the items in the collection. I then added descendants of these classes (ImageCollection, ImageItem)....
2
by: kw | last post by:
I'm getting different behavior from what I would expect and was hoping someone could clue me in. At run time I need to examine a property of an object for a custom TypeConverter, then use that...
1
by: Sky Sigal | last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols) I've been looking lately for a way to keep the Properties panel for Controls 'clean'... My goal is to keep similar...
5
by: ljlevend | last post by:
Is there a TypeConverter that converts Doubles to percent values in a PropertyGrid? The Windows.Forms.Form.Opacity property seems to use the TypeConverter that I want. Thank you, Lance
4
by: Kent Boogaart | last post by:
*tried this already on the buildingcontrols newsgroup but didn't get a response* Hi, As far as I can tell, it is not possible to use the TypeConverter infrastructure with generic types. Say...
4
by: swartzbill2000 | last post by:
Hello, I have a TypeConverter for converting between this Enum and Strings. Public Enum DeviceNameEnum dnNone dn2500 dnMirror End Enum 'DeviceNameEnum
11
by: Rolf Welskes | last post by:
Hello, the problem seems to be complex and is in all developments of web-controls which uses own TypeConverter. For this I have here a simple demo-program of the problem: The Control-code: A...
1
by: --== Alain ==-- | last post by:
Hi, I 'm facing an interesting issue regarding a property and its TypeConverter. When i do not attach a TypeConverter to this property, all custom properties of my custom control are displayed...
6
by: Larry Smith | last post by:
Hi there, Can anyone provide any insight on why MSFT introduced "TypeConverter.GetProperties()". There are two classes for dealing with metadata in .NET, 'Type" and "TypeDescriptor". Each has a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.