Microsoft KB Archive/818811

= PRB: &quot;Invalid property value&quot; Error Message While Setting Values for User Control Properties in Design View When Using Visual Studio .NET =

Article ID: 818811

Article Last Modified on 5/12/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.0

-



SYMPTOMS
If you try to set the value of the BrowsableAttribute property to TRUE during design time in Microsoft Visual Studio .NET, and if the control class has certain types of properties, you receive the following error message:

Invalid property value

The following are the types of control class properties that this situation applies to:
 * PointF
 * SizeF
 * RectangleF



CAUSE
This problem occurs because predefined type converter classes are not available for the structures that are listed in &quot;Symptoms&quot;. The default converters for the classes are as follows:

Note You cannot use these default converters as the type converters for PointF, SizeF and RectangleF.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



WORKAROUND
To work around this problem, use one of the following methods:

Use different types for the properties that are to be exposed by the control:

- or -

Use type converters for PointF, SizeF and RectangleF.

For more information about how to write type converters, see the &quot;References&quot; section of this article.



Steps to Reproduce the Behavior
 Create a Microsoft Visual C# Windows Control Library in Visual Studio .NET.  Add the following code to the code that the wizard generated for the user control class: private PointF m_Point;

[Browsable(true)] [TypeConverter(&quot;System.Drawing.PointConverter, System.Drawing&quot;)] public PointF Position {   get {       return m_Point; }   set {       m_Point = value; } }  Build the application. Create a Visual C# Windows application in Visual Studio .NET. Right-click Windows Forms Toolbox, and then click Customize Toolbox. In the Customize Toolbox dialog box, select the .NET Framework Components check box, and then click Browse.</li> In the Open dialog box, specify the path of the dynamic link library (DLL) that you created for the Windows Control Library (steps 1 to 3), and then click Open.</li> Click OK to close the Customize Toolbox dialog box.</li> Drag the user control from the Windows Forms Toolbox onto the design view.</li> Right-click the control on the design view, and then click Properties.</li> Scroll to the Position property that is under the Misc section.

If you modify the value of this property, you receive the error that is mentioned in the &quot;Symptoms&quot; section.</li></ol>

<div class="references_section">