Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Imports System.IO


Public Class Csv
    Dim ResourceFilePath As String


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        SelectPageList.Show()
        Me.Close()

    End Sub

    Private Sub AxWindowsMediaPlayer1_Enter(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.Enter
        ' Determine the Resource File Path
        If System.Diagnostics.Debugger.IsAttached() Then
            'Debugging mode
            ResourceFilePath = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\resources\")
        Else
            'Published mode
            ResourceFilePath = Application.StartupPath & "\resources\"
        End If

        ' Specify the mp3 file
        AxWindowsMediaPlayer1.URL = ResourceFilePath & "\C:\Users\teejayfpi\Documents\Visual Studio 2013\Dr ajii\WindowsApplication2\csv.avi"
        ' Media Player automatically plays file by default

    End Sub

    Private Sub Csv_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class


What I have tried:

please kindly help me with this
Posted
Updated 21-Feb-18 2:26am

1 solution

Um... look at what your path is going to be:
VB
        If System.Diagnostics.Debugger.IsAttached() Then
... It isn't., so we ignore this.
        Else
            'Published mode
            ResourceFilePath = Application.StartupPath & "\resources\"
        End If
        ' Specify the mp3 file
        AxWindowsMediaPlayer1.URL = ResourceFilePath & "\C:\Users\teejayfpi\Documents\Visual Studio 2013\Dr ajii\WindowsApplication2\csv.avi"

So you will get a path like this:
C:\Program Files\My App\\C:\Users\teejayfpi\Documents\Visual Studio 2013\Dr ajii\WindowsApplication2\csv.avi
Which is far from being a valid path!
 
Share this answer
 
v2
Comments
Member 13341316 21-Feb-18 8:35am    
this was the path i used before but still will not play after compilation


Imports System.IO


Public Class Csv
Dim ResourceFilePath As String


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SelectPageList.Show()
Me.Close()

End Sub

Private Sub AxWindowsMediaPlayer1_Enter(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.Enter
' Determine the Resource File Path
If System.Diagnostics.Debugger.IsAttached() Then
'Debugging mode
ResourceFilePath = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\resources\")
Else
'Published mode
ResourceFilePath = Application.StartupPath & "\resources\"
End If

' Specify the mp3 file
AxWindowsMediaPlayer1.URL = ResourceFilePath & "\csv.avi"
' Media Player automatically plays file by default

End Sub

Private Sub Csv_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub
End Class
Dave Kreskowiak 21-Feb-18 8:43am    
Your STILL running into an invalid path. USE THE DEBUGGER!! You can figure this out yourself quite easily. Look at the path you're sending to the URL property. It's going to have TWO backslashes before csv.avi, not one.

INstead of appending the filepaths together yourself with string concatentation, use Path.Combine() instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900