We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Dim myStream As Stream = Nothing Dim openFileDialog1 As New OpenFileDialog() openFileDialog1.InitialDirectory = Application.StartupPath & \Data\ openFileDialog1.Filter = "Icon files (*.ico|" openFileDialog1.FilterIndex = 2 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. Here is the 'something like this? mydate = read(buffer, 1, 16) 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
Join the community of 500,000 technology professionals and ask your questions.