how to create user control in c# windows application
  • Hi today i am sharing how can we make and use user control in c#.I am making a control who will show date and time

    Create Windows Forms Control library Project Follow below steps.


    Drag and drop labels or what you want in control here i am dragging labels as per my requirement.


    Double click on control and write code for events..

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace DateTimeControl
        public partial class ucDateTime : UserControl
            public ucDateTime()

            private void ucDateTime_Load(object sender, EventArgs e)
                lblDate.Text = DateTime.Now.ToShortDateString();
                timer1.Interval = 1000;

            private void timer1_Tick(object sender, EventArgs e)
                lblTime.Text = DateTime.Now.ToShortTimeString();

    build this project by F5.

    Then create a windows Application.


    Add UserControl in ToolBox, Right click on toolbox then select choose
    items and then browse your user control DLL who will found in your
    Windows Forms Control Library Projects' bin folder.



    Then you can find this control in your tollbox


    then drag and drop User Control to Form.


    then F5 and see result.

  • 2 Comments sorted by
  • Cool article.Thank You.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook


Popular Posts of the Week

    Optimum Creative