Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,172
Total Posts: 566,877
There are 34 users currently browsing (tf).
  Our Partners:
  TalkFreelance     Design and Development     Programming     .NET and MSSQL :

Visual Basic OpenFileDialog problem

Thread title: Visual Basic OpenFileDialog problem
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
08-10-2007, 02:53 PM
Nightscream is offline Nightscream
Status: Junior Member
Join date: Aug 2006
Posts: 58
iTrader: 0 / 0%

Nightscream is on a distinguished road

  Old  Visual Basic OpenFileDialog problem

I got a problem with a visual basic script to get OpenFileDialog, to browse a filename
but always getting errors at the second line, something with As Stream.
Maybe you can fix this problem ^_^
(it's in access)

thanks in advance

Private Sub Bladeren_Click()
Dim myStream As Stream = Nothing
    Dim openFileDialog1 As New OpenFileDialog()

    openFileDialog1.InitialDirectory = "N:\"
    openFileDialog1.Filter = "All files (*.*)|*.*"
    openFileDialog1.FilterIndex = 1
    openFileDialog1.RestoreDirectory = True

    If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            myStream = openFileDialog1.OpenFile()
            If (myStream IsNot Nothing) Then
                ' Insert code to read the stream here.
                Voorbeeld = myStream
            End If
        Catch Ex As Exception
            MessageBox.Show ("Cannot read file from disk. Original error: " & Ex.Message)
            ' Check this again, since we need to make sure we didn't throw an exception on open.
            If (myStream IsNot Nothing) Then
            End If
        End Try
    End If
End Sub


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed