newguy
Well-known member
Hi All.
Trying to save listbox.items(text) to a file and I keep getting a error - unable to process the file as another process is using it. So what am I doing wrong???
Thanks...
Trying to save listbox.items(text) to a file and I keep getting a error - unable to process the file as another process is using it. So what am I doing wrong???
VB.NET:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim file_name As String = "c:" & txtFileName.Text & ".txt"
System.IO.File.Create(file_name)
If System.IO.File.Exists(file_name) = True Then
Dim objWriter As New System.IO.StreamWriter(file_name)
Dim int As Object
int = ListBox2.Items.ToString
objWriter.Write(int)
objWriter.Write("This is a test")
objWriter.Close()
End If
End Sub
Thanks...