Christopherx
Well-known member
- Joined
- Jul 4, 2010
- Messages
- 58
- Programming Experience
- Beginner
This particular function is used to save the returned results for a ping sent across the internet. Unfortunately the code won't let me Use the streamwriter method or the fileopen method, because it says:
"The process cannot access the file 'C:\Users\Chris\Documents\Pinging Data\Filesave2.txt' because it is being used by another process."
A solution would be greaatly appreciated
"The process cannot access the file 'C:\Users\Chris\Documents\Pinging Data\Filesave2.txt' because it is being used by another process."
VB.NET:
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
FileOpen(1, "C:\Users\Chris\Documents\Pinging Data\count.txt", OpenMode.Input, OpenAccess.Read)
Dim count As String
Dim realcount As Integer
count = LineInput(1)
realcount = count
realcount = realcount + 1
FileClose(1)
FileOpen(1, "C:\Users\Chris\Documents\Pinging Data\count.txt", OpenMode.Output, OpenAccess.Write)
PrintLine(1, realcount)
FileClose(1)
File.Create("C:\Users\Chris\Documents\Pinging Data\Filesave" & realcount & ".txt")
Dim sw As New StreamWriter("C:\Users\Chris\Documents\Pinging Data\Filesave" & realcount & ".txt")
sw.Write("IP")
sw.WriteLine(" " & TextBox1.Text)
sw.Write("Outcome")
sw.WriteLine(" " & TextBox2.Text)
sw.Write("Address")
sw.WriteLine(" " & TextBox3.Text)
sw.Write("Round Trip/Ms")
sw.WriteLine(" " & TextBox4.Text)
sw.Write("Buffer")
sw.WriteLine(" " & TextBox5.Text)
sw.Write("Server On/Off")
If TextBox7.BackColor = Color.Red Then
sw.WriteLine(" " & "Off")
End If
If TextBox7.BackColor = Color.Green Then
sw.WriteLine(" " & "On")
End If
End Sub
A solution would be greaatly appreciated