[RESOLVED] [2005] A strange error in streamwriter
Code:
Private Sub frmProducts_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Dim i As Integer, Str As String = ""
Dim file As System.IO.StreamWriter
For i = 0 To lsbProducts.Items.Count - 1
Str = Str & lsbProducts.Items.Item(i).ToString & vbCrLf
Next
file = My.Computer.FileSystem.OpenTextFileWriter(AppPath & "\Ürünler.txt", True)
file.Write(Str)
file.Close()
Me.Close()
End Sub
It was the code. It tries to write to a textfile which is on a memory stick. but the problem is it writes and doesnt stop. ıt writes same thing again and again...
Where is the problem?
Re: [2005] A strange error in streamwriter
The FormClosed event is raised when the form is closed. Why the call to Me.Close? Do you suppose that that's causing the FormClosed event to be raised over and over?
Re: [2005] A strange error in streamwriter
yes thanks again jmcilhinney...