Add ComboBox Property at Winform Designer Time

Step 1: Create window form application.

consider you have Form1.cs

Write down following code in Form1.cs

namespace WindowsFormsApplication1

{

public enum SelectedPanelForTreeView

{

FolderList,

Mail,

Calander,

Contact,

Task,

Note,

Journal,

Search

}

public partial class Form1 : Form

{

SelectedPanelForTreeView ObjSelectedPanelForTreeView = SelectedPanelForTreeView.FolderList;

[Category("Choose Default TreeView Panel")]

[Browsable(true)]

[Description("Select the panel to show default selected under treeview by default FolderList is selected ")]

public SelectedPanelForTreeView DefaultSelectedPanel

{

get { return ObjSelectedPanelForTreeView; }

set { ObjSelectedPanelForTreeView = value; }

}

public Form1()

{

InitializeComponent();

}

}

Here, I have created the Enum to add items in combo box.

Step2: Create Form2.cs along with its Designer.cs Inherit the Form2 from Form1

Step 3: Click on Form 2 Designer you can able to select property from com box under "Choose Default TreeView Panel" category as

Property.png

Ebook Download
View all
Learn
View all