but always getting errors at the second line, something with As Stream.
Maybe you can fix this problem
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 Try 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) Finally ' Check this again, since we need to make sure we didn't throw an exception on open. If (myStream IsNot Nothing) Then myStream.Close() End If End Try End If End Sub