I have two masked TextBox controls and was wondering how I\'d go about getting the time in each one and then converting the difference into milliseconds. Like, say in tb1 I
You have to convert textbox's values to DateTime (t1,t2), then:
DateTime t1,t2; t1 = DateTime.Parse(textbox1.Text); t2 = DateTime.Parse(textbox2.Text); int diff = ((TimeSpan)(t2 - t1)).TotalMilliseconds;
Or use DateTime.TryParse(textbox1, out t1); Error handling is up to you.