Hi guys
Suppose I have a form with a button and a openfiledialog.
Here's my code : Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim fs As New IO.StreamReader(OpenFileDialog1.OpenFile, System.Text.Encoding.GetEncoding("iso-8859-1")) fs.Close() fs.Dispose() End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load OpenFileDialog1.ShowDialog() End Sub End Class
I choose a file (test.txt). I click the button1 once. I click the button1 twice -> error because the stream on the file is never close.. Could we have a "OpenFieldDialog.CloseFile()" methods in future? Thanks Francois |
|