Click here to Skip to main content
15,923,083 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Someone Help...

I used VB2008 in this project of mine...

Here is what I did:

I created a Custom Class named it to "CustomClass". I created some properties for this class "Num1" and "Num2" they are both integers. The toSring() was overridden. I also implemented a Type Converter for this class some function were overridden "CanConvertFrom, CanConvertTo, ConvertFrom, ConvertTo, GetStandardValuesSupported and GetStandardValues".

I created a Custom Control named it to "CustomControl", Set CustomClass as its property.

Public Class CustomControl : Inherits Control
   Private _sample As New CustomClass(1,2)

   Public Property sample() as CustomClass
      'Get here...
      'Set here...
   End Property
Enc Class

This is what it looked like. The PropertyGrid displays the Property I created.
-------------
sample | 1,2 |
-------------
Num1   | 1   |
Num2   | 2   |
-------------

All went fine but every time I set a different value to each property the values reset back to their defaults.
Posted
Updated 27-Mar-11 0:15am
v2

1 solution

I think you should define the DesignerSerializationVisibilityAttribute[^] for the property.
 
Share this answer
 
Comments
Albin Abel 27-Mar-11 11:27am    
Correct answer. my 5
Wendelius 27-Mar-11 11:42am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900