[VB.NET] Open File Dialog

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

I keep getting the exception when trying when clicking on the OpenFile button, but it is fine for the PlayDVD button, so i am assuming its something i am doing wrong with the openfiledialog.

The error i get is: "The specified file could not be found"

Code:
    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)
        End If

    End Sub

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

        Try
            MonitorOff(Me.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF)
            Process.Start("profiles\tv.umprofile")
            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

Can anyone shed light on what i am doing wrong.

Thanks.
 
Back
Top Bottom