I am trying to put a progress bar on a media player
can you help please
Public
Sub Readtrack()ProgressBar1.Minimum = track start()
ProgressBar1.Maximum = track
end()Dim i As Integer For i = 1 To 100
ProgressBar1.Increment( )
Next iEnd
SubI am trying to put a progress bar on a media player
can you help please
Public
Sub Readtrack()ProgressBar1.Minimum = track start()
ProgressBar1.Maximum = track
end()Dim i As Integer For i = 1 To 100
ProgressBar1.Increment( )
Next iEnd
Sub
progress bar
Behz
dont know what I am doing wrong
this is what I got now and it wont work for me
Bar1.Minimum = 1
Bar1.Maximum = 100
Dim TrackLength As Integer Dim TrackPosition As Integer = 1 Dim TrackPositionPercentage As Integer = 1 Dim trackPercentageCompleted As Integer = 0 If TrackLength > 0 ThentrackPercentageCompleted = TrackPosition \ TrackLength * 100
End IfBar1.Value = trackPercentageCompleted
moreOncoding
Dim TrackPositionPercentage as integer = 0
If TrackLength >0 then
TrackPositionPercentage = cInt(TrackPosition / TrackLength *100)
End If
TrackPositionPercentage will then have a value of 0 to 100 which you can simply put into the Progressbar value.
0xDEADBEEF
Bar1.Minimum = 0
Bar1.Maximum = 100
Dim TrackLength As Integer = mediaplayer1.Duration
Dim TrackPosition As Integer = mediaplayer1.CurrentPosition
Dim trackPercentageCompleted As Integer = 0
If TrackLength > 0 Then
trackPercentageCompleted = TrackPosition \ TrackLength * 100
End If
Bar1.Value = trackPercentageCompleted
End Subandrewtan00
Hi nogchoco
thanks for the reply
but I just cant seem to be able to get this to work
could you possibly elaborate a bit more
thanks
cheyenne
Cyber Sinh
Keep the Progressbar's minimum at 0 and its maximum at 100, and then the progressbarvalue is a percentage from 0-100% completed.
The code is simply to calculate that 'percentage completed' by dividing the movie's currentposition by the total movielength (which gives a value between 0 and 1 because the currentposition can't go past the movielength), and then *100 to make it a percentage. In the example below, I've replaced the cInt by using a backslash to do the dividing (which gives an integer result anyway):
Dim MoviePercentageCompleted as integer = 0
If MovieLength >0 then
MoviePercentageCompleted = MovieCurrentPosition \ MovieLength *100
End If
Progressbar1.Value = MoviePercentageCompleted