locked
AxWindowsMediaPlayer duration RRS feed

  • Question

  • hi

    -i want to convert WindowsMediaPlayer duration to time  (00,00,00)

    code not  work

    Dim time As DateTime = Convert.ToDateTime(AxWindowsMediaPlayer1.currentMedia.duration)
    
            Label1.Text = time


    Tuesday, May 14, 2019 9:34 PM

Answers

  • Hi,

    AxWindowsMediaPlayer1.currentMedia.duration returns a double type,you can use code:

    Dim ts As TimeSpan = New TimeSpan(0, 0, AxWindowsMediaPlayer1.currentMedia.duration)
    Label1.Text = ts.Hours.ToString("D2") & "," & ts.Minutes.ToString("D2") & "," & ts.Seconds.ToString("D2")

    or try the code:

    Label1.Text=AxWindowsMediaPlayer1.currentMedia.durationString

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by ahmeddc Friday, May 17, 2019 1:16 AM
    Wednesday, May 15, 2019 2:32 AM