C# Exercises

Home AgriMetSoft About Contact

Create User Control in Winforms c#

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

namespace User_Control
{
  public partial class DClock : UserControl
  {
    Timer tm;
    public DClock()
    {
      InitializeComponent();
      tm = new Timer();
      tm.Interval = 1;
      tm.Tick += tm_Tick;
      tm.Start();
    }
    void tm_Tick(object sender, EventArgs e)
    {
      label1.Text = DateTime.Now.ToString("HH:mm:ss");
    }
  }
}
		
	 


Download the project of Visual Studio 2013 in DropBox Download


How to Create and Use a User Control in Winforms C# | User Control Example


List of Exercises