How to set media (Video & Audio) source file programmatically in window.xaml.vb? RRS feed

  • Question

  • Does anyone know how to set media (Video&Audio) source file programmatically in window.xaml.vb?  I wrote my code as below but there's error with it.

    Public Class Window4
        Private Sub PlayBtn_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles PlayBtn.Click
            Video1.Source = Uri("C:\Documents and Settings\jason\My Documents\My Videos\try1.wmv")
        End Sub
    End Class


    Wednesday, February 15, 2012 12:52 AM


  • Hi,

    I think it should be something like

     Video1.Source = new Uri(@"C:\Documents and Settings\jason\My Documents\My Videos\try1.wmv", UriKind.Absolute);


    • Marked as answer by Jason2726 Wednesday, February 15, 2012 5:36 AM
    Wednesday, February 15, 2012 2:42 AM