void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { ////////////////////////////////////////////////////////////load media/////////////////////////////////////////////// string chosen = listBox1.SelectedItem.ToString(); string final = selectedpath2 + "\\" + chosen; control.SetMedia(new Uri(final).AbsoluteUri); control.Audio.Volume = 0; control.Update(); ////////////////////////////////////////////////////////////calculate trackbar length/////////////////////////////////////////////// var player = new WindowsMediaPlayer(); var clip = player.newMedia(final); string vOut = clip.duration.ToString(); long howdy = Convert.ToInt64(clip.duration); string vOut2 = vOut.Replace(".", ""); int x = Int32.Parse(vOut2); int x_result = x * 10; trackBar1.Maximum = x_result; trackBar1.Minimum = 0; Console.WriteLine("Track Bar Maximum : " + trackBar1.Maximum); Console.WriteLine("Track Bar Maximum : " + trackBar1.Minimum); Console.WriteLine("Track Tick Frequency : " + trackBar1.TickFrequency); button9.PerformClick(); System.Threading.Thread.Sleep(1000); button8.PerformClick(); trackBar1.Value = 0; Time_update(0); }