473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 UniversalTypeCo nverter
which inherits from ExpandableObjec tConverter, 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 UniversalTypeCo nverter, 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.MyCl assCCollection
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: DesignerSeriali zationVisibilit y(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 1186

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

Similar topics

0
1902
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). The persistence etc works fine until I add a property to the descended class, and then the created items do not appear in the collection editor...
2
3407
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 converter on a value. Here's the deal: object attrs=(object)PropertyInfo.GetCustomAttributes(typeof(TypeConverterAttribu te),false);
1
1691
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 public properties of a custom Control neatly tied together -- rather than all over the IDE. One such set of values that will rarely be changed, so...
5
2179
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
2164
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 you have this type: public struct Id<T> where T : IComparable { ... }
4
1693
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
2326
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 class MyString which is a class which is similar to a string public class MyString {
1
2148
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 in Test Container. Since i attached this TypeConverter to my property, ALL custom properties (properties implemented by myself) are not displayed...
6
3883
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 "GetProperites()" method so why complicate the situation even more than it already is by adding a "GetProperties()" method to "TypeConverter". The...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.