private void txtInput_TextChanged(object sender, System.EventArgs e) { TimeSpan ts; try { string s = this.txtInput.Text; if (s.ToLower().IndexOf("min") > 0) { int i = s.ToLower().IndexOf("min"); string temp = s.Substring(0, i); int number = Int32.Parse(temp); ts = new TimeSpan(0, number, 0); } else { ts = TimeSpan.Parse(s); } duration = ts; this.lblDuration.Text = ts.ToString(); btnRecord.Enabled = true; } catch { duration = new TimeSpan(0); lblDuration.Text = "Not understood"; btnRecord.Enabled = false; } }