OpenFileDialog Problem

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Hi there,

My openfiledialog keeps causing me problems with the error:

The specified file could not be found

Here is my code:

VB.NET:
    Private Sub PlayDVD(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDVD.Click

        PlayerLoad("D:\VIDEO_TS", 2000)

    End Sub

    Private Sub OpenFile(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilm.Click

        If openVideo.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            PlayerLoad(openVideo.FileName, 1000)
            'PlayerLoad("D:\VIDEO_TS", 1000) ---- THIS DOES NOT WORK EITHER!!!
        End If

    End Sub

    Private Sub PlayerLoad(ByVal fileLoad As String, ByVal sleepTime As Integer)

        Try
            Process.Start("profiles\tv.umprofile")
            MessageBox.Show("""player\player.exe"" - """ & fileLoad & """ - /play")
            Shell("""player\player.exe"" - """ & fileLoad & """ - /play")
            Threading.Thread.Sleep(sleepTime)
            SendKeys.Send("%{ENTER}")
            Me.Hide()
            btnRestore.Enabled = True
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

The playDVD button works fine, but the openFile button does not. Its the openfiledialog thats causing the problem (see code for why in comment).

What am i doing wrong?

Thanks.
 
Can I help you?

Can you give more detail about what the error is? I used the following code to get an OpenFileDialog to open the DVD video folder which is in my "E:" drive.

Private Sub btnFilm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilm.Click
OpenFileDialog1.InitialDirectory =
"E:\VIDEO_TS"
OpenFileDialog1.ShowDialog()
End Sub



 
Back
Top