How to create a usercontrol in windows Application


User Controls are controls which are created by user and they are based on the class System.Windows.Forms.UserControl. Like standard controls, user controls properties, methods and events. Once a user control is created it can be added to any form or any number of forms like all other controls.

1. Open Microsoft Visual studio or Open Run and enter Devenv.

2. Go to Main Menu and Open File – New – Project

new project

New Project Window will appear

window

 

By default user control window form will appear as above

 

Create your own control as you like .

For example  I am creating one login control

Select Project type and templates as Windows Control Library

 

Rename the Project as user control

Browse the Location to save in a path : c:\userconrol

Solution as Create new solution

Click OK to continue

user control

By default user control window form will appear as above 

Create your own control as you like .

For example  I am creating one login control

login

Go to Main menu – Build – select Build solution

build solution

After Build solution usercontrol.dll will create at the path where we have stored the windows application project.

C drive ->your windows application name à bin folderà Debug folder à usercontrol.dll

Path: C:\usercontrol\usercontrol\usercontrol\bin\Debug 

Right click on the tool bar and select choose items.

choose item

Select .Net Framework Components

Browse the user control.dll file

com components

browse

Click OK to continue.

After doing this user control will directly added into the toolbar.

Right click on that user control and rename it as Login control.

rename

User control in ready to user .enjoy……

Advertisements

One thought on “How to create a usercontrol in windows Application

Thanks a lot for visiting this site .. Please leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s