how to change timespan variable to a integer type?

 private void dateTimePicker4_ValueChanged(object sender, EventArgs e)
    {
        TimeSpan t = dateTimePicker4.Value.ToLocalTime() - dateTimePicker3.Value.ToLocalTime();
        int x = int.Parse(t.Minutes.ToString());
        y = x;
    }

Have you tried changing it to int x = int.Parse(t.Minutes.ToString());?

From : http://msdn.microsoft.com/en-us/library/system.timespan.aspx


the difference in minutes between them should be displayed in a textbox automatically.

Instead of parsing use TimeSpan.TotalMinutes property.

t.TotalMinutes;

The property is of double type, if you just need to integer part then you can do:

int x = (int) t.totalMinutes;