I am working on a program that calculates the difference between two given times. The difference between two times is calculated with button1 event handler and is displayed in label as shown in the windows form layout shown below.
This is my interface:
My code:
I hope my question is clear. I tried my best but couldn't make it work. I just keep getting the wrong answer:
public Form1()
{
InitializeComponent();
}
DateTime t1 = new DateTime(0, 11, 0);
DateTime t2 = new DateTime(0, 16, 30);
DateTime Dif = new DateTime(0, 0, 0);
private void button1_Click(object sender, EventArgs e)
{
Dif = t1 - t2;
Dif = Dif + DateTime.Parse(label1.Text);
label1.Text = Dif.ToString();
}