Here's what i'm currently trying to do: Create a stop watch in which you can see the time as it counts, dynamically. Here's my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Stopwatch stopWatch = new Stopwatch();
public Form1()
{
InitializeComponent();
}
private void start_Click(object sender, EventArgs e)
{
stopWatch.Start();
}
private void stop_Click(object sender, EventArgs e)
{
stopWatch.Stop();
timePrint();
}
private void reset_Click(object sender, EventArgs e)
{
stopWatch = Stopwatch.StartNew();
}
private void timePrint()
{
label1.Text = stopWatch.ElapsedTicks.ToString();
hours.Text = "Time elapsed: " + stopWatch.Elapsed;
}
}
}
Any suggestions on how I should go about this?


Sign In
Create Account


Back to top










