Custom properties
-
hey i have created my own custom property the property is of type collection , it displays a form which allow the user to add a list of images and strings, it stores the data in a collection , my problem is , i have noticed that after adding items to the collection at design time , there is no code generated in the .Designer file of the form and there for when i close the for / save it and reload it , all the items that i added to my custom property are gone. my question , what did i miss here ? how do i make my custom property generate code at the .designer file for the items i have added to my property? thanks.
Net
-
hey i have created my own custom property the property is of type collection , it displays a form which allow the user to add a list of images and strings, it stores the data in a collection , my problem is , i have noticed that after adding items to the collection at design time , there is no code generated in the .Designer file of the form and there for when i close the for / save it and reload it , all the items that i added to my custom property are gone. my question , what did i miss here ? how do i make my custom property generate code at the .designer file for the items i have added to my property? thanks.
Net
You have to tag the public properties you want the designer to write code for with the
DesignerSerializationVisibility
attribute. Like this:DesignerSerializationVisibility(DesignerSerializationVisibility.Visible) \_ Public Property MyControlProperty() as Integer .... End Property
You can find the docs on the DesignerSerializationVisibility Attribute class here[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008