Custom property on form not persisting value in VS 2005



I posted before about collections but have since tried on a simple single
class and it's not working either. I'm using VB.NET but I thought it now had
the same designtime capabilities as C#.

Here's what I've done...

- New application (CF2)
- New class library in same solution

in the class library...
- make up a new class - just with two simple string properties, e.g.

Public Class Item

Private _Title As String
Property Title() As String
Get
Return _Title
End Get
Set(ByVal value As String)
_Title = value
End Set
End Property

Private _Value As String
Property Value() As String
Get
Return _Value
End Get
Set(ByVal value As String)
_Value = value
End Set
End Property

End Class

- I add a form to the class library and put a property on it of type "Item"
as per above class.

- Then I go into class diagram to add the designer stuff...

- On the form class I've got:
Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()
DesignTimeVisible(true)
DesktopCompatible(true)

- On the property of the form I've made up:
TypeConverter(" System.ComponentModel.ExpandableObjectConverter, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ")
Category("_Test")
Description("Test")
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)
Browsable(true)

- On the Item class:
DesignTimeVisible(true)
DesktopCompatible(true)

- NOTE: I haven't added any design time stuff to the properties of the Item
class (e.g. "Title", "Value")

In the application I then add a form inheriting from the one in the class
library and in the designer I can see the property, and even change the
values - but when I close the form and re-open it the values are gone. It's
not writing anything to the InitializeComponent() section.

One other question - why can't I see the property in the designer when I
view the "base form" - the one in the class library? why does the "Item"
property only show on inheriting forms?

Any help would be appreciated. Thanks.


.



Relevant Pages

  • Re: Disappearing Controls when the designer loads a form.
    ... which were traced to an exception my user control threw while in the designer. ... private ArrayList readOnlyColumnsList; ... public string ReadOnlyColumns ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Not first class in file
    ... loading the designer again. ... Public strTo As String ... ' This call is required by the Component Designer. ... Protected Overloads Overrides Sub Dispose ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DataTable Designer in VS2008
    ... Your problem here is not with the designer but with the T-SQL language. ... taking a string parameter and returning a table: ... WHERE primaryKeyID IN ...
    (microsoft.public.vstudio.development)
  • Re: 3 Fragen zu WebControl
    ... Definitiv sind aber die Werte für das Category-Attribut Englisch. ... Attribute haben nur einfluss auf die designer in VS nicht aufs aussehen ... public override string GetDesignTimeHtml() ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Change Rave Report Connection String at runtime
    ... I've created some basic Rave Reports (using the designer which came ... with D2005) and I want to change the string for the database connection ... I can easily sort out the drive letter, but I can't seem to find the ...
    (comp.lang.pascal.delphi.misc)