Windows Forms designer sample demoed in VB (VBWinFormDesigner)

The code sample demonstrates various typical programming scenarios in Windows Forms Designer

VB.NET (85.1 KB)
4 Star
17,177 times
Add to favorites
E-mail Twitter Digg Facebook
       WINDOWS FORMS APPLICATION : VBWinFormDesigner Project Overview
                   PropertyDisplayOrder Sample


The PropertyDisplayOrder sample demonstrates how to change the default display 
order on Properties windows for properties, and how to expand a nested property 
on the Properties window. 


1. Create a UserControl;

2. Add a reference to the System.Designer.dll;

3. Create a class named SubClass, and add some properties in it;

4. Create a property of SubClass type for the UserControl class;

5. Create a class derive from the ExpandableObjectConverter class ( The 
   ExpandableObjectConverter class provides a type converter to convert 
   expandable objects to and from various other representations.);

6. Override the ExpandableObjectConverter.GetPropertiesSupported() method to 
   return "true", which makes sure the corresponding object supports properties;
7. Override the ExpandableObjectConverter.GetProperties() method to specify 
   the display order for the properties;
5. Mark the UserControl.Cls property with TypeConverter attribute to make it use 
   the TypeConverter created by the steps above:
   Public Class UC_PropertyDisplayOrder
        Private _cls As SubClass = New SubClass

    <TypeConverter(GetType(PropertyOrderConverter))> _
    Public Property Cls() As SubClass
                Return Me._cls
            End Get
            Set(ByVal value As SubClass)
                Me._cls = value
            End Set
        End Property
    End Class
6. Build the project.

7. Now the UserControl is available on the toolbox for use.


1. ExpandableObjectConverter Class

2. TypeConverter.GetPropertiesSupported Method

3. ExpandableObjectConverter.GetProperties Method

4. Windows Forms FAQs