I am trying to use time span and total seconds but it can't convert string to long. This is the code I have so far, I am trying to convert a
Stamp = "01:22:22"
Dim SetPos As New TimeSpan(Stamp)'error happens just here (Conversion from string to type 'Long' is not valid.)
Dim Seconds As Double = SetPos.TotalSeconds
Dim controls As WMPLib.IWMPControls3 = plrVideo.Ctlcontrols
controls.currentPosition = Seconds 'setting play head to seconds from start
I know its way over complicated but this is what i ended up with thanks to D le
Dim timeString = Stamp.Split(":") If UBound(timeString) = 2 Then Dim hour = timeString(0) Dim min = timeString(1) Dim sec = timeString(2) Dim totalSecs As Integer = CInt(hour) * 60 * 60 + CInt(min) * 60 + CInt(sec) SetPos = totalSecs Else If UBound(timeString) = 1 Then Dim min = timeString(0) Dim sec = timeString(1) Dim totalSecs As Integer = CInt(min) * 60 + CInt(sec) SetPos = totalSecs End If End If