Hi,
I am currently creating a media player using c#. I want to add a seek function to my application to allow users to jump to parts of a song. Does anyone know of an easy way to do this? I use a progress bar to show the currnet progress of the track.

Here is my code:
void musicDuration_Tick(object sender, EventArgs e)
{
try
{
if (trackPercentage > 100)
{
musicDuration.Stop();
musicDuration.Dispose();
}
else
{
trackLength = (int)wmp.currentMedia.duration;
trackPos = (int)wmp.Ctlcontrols.currentPosition;


lblDuration.Text = wmp.currentMedia.durationString;
lblCurPos.Text = wmp.Ctlcontrols.currentPositionString;

trackPercentage = (int)(trackPos * 100) / trackLength;
pb_length.Value = trackPercentage;
lblTrackPercentage.Text = "" + trackPercentage + "%";
}

}
catch (Exception Er){
Console.Out.Write(Er.Message);
}
}


Thanks in advance

There is something called a TrackBar .. why are you using a progress bar ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.