The process cannot access the file \'F:\\copy back up\\system\\HRM 2-5-2013\\HRM\\HRM\\lanbased.txt\' because it is being used by another process. This is my code in sub main
Looks like you need to close your streamReader before opening the new form:
objReader.Close()
That will free the file.
first you open your file for reading here :
Dim objReader As New System.IO.StreamReader(NAME1) //1st open
Second you call the form1 : Application.Run(New Form1())
in that Form you have : Dim objWriter As New System.IO.StreamWriter(FILE_NAME) //2nd open
But wait you didn't close your file
so you can't open it 2nd time for writing.
So you need to close the file before calling create form 1
like objReader.close()
conn.Open()
objReader.close() <----- this one
Application.Run(New Form1())