I am trying to use the open dialog to allow the user to select the file being computed. I think my code is right, but visual basic says that 'type stream has not been defined'.
Any help is appreciated. Code below.
champ0342
Code:Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim myStream As Stream = Nothing Dim ofd As New OpenFileDialog() ofd.InitialDirectory = "c:\" ofd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" If ofd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then Try myStream = ofd.OpenFile() If (myStream IsNot Nothing) Then End If Catch Ex As Exception MessageBox.Show("Cannot read file from disk. Try another file) Finally If (myStream IsNot Nothing) Then End If End Try End If End Sub




Reply With Quote