public void timer_Tick(object sender, EventArgs e) { double ms = stream.GetMs(output); trackBar1.Value = (int)(ms / granularity); if (trackBar1.Value >= trackBar3.Value) { output.Stop(); } if (output.PlaybackState == PlaybackState.Stopped) { timer.Stop(); } textBox3.Text = TimeSpan.FromMilliseconds(ms).ToShortForm(); }