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
If you are only dealing with Times and no dates you will want to only deal with TimeSpan and handle crossing over midnight.
TimeSpan time1 = ...; // assume TimeOfDay
TimeSpan time2 = ...; // assume TimeOfDay
TimeSpan diffTime = time2 - time1;
if (time2 < time1) // crosses over midnight
diffTime += TimeSpan.FromTicks(TimeSpan.TicksPerDay);
int totalMilliSeconds = (int)diffTime.TotalMilliseconds;