Hi ! im having some trouble with the following code..
------------------------------------------------------------------------
dim sr as System.IO.StreamReader;
dim readtag as string;
dim line as string;
dim line2 as string;
System.IO.File.Delete("C:\Recipe2.txt");
System.IO.File.Copy("C:\Users\joaco\Documents\workorders\Recipe.txt","C:\Recipe2.txt");
sr = System.IO.File.OpenText("C:\Recipe2.txt");
line = "";
ListBox1.Clear();
while line <> null
line=sr.ReadLine();
line=Stringmid(line,2,20);
if line.Equals("") then
else
ListBox1.AddItem(line);
endif;
endwhile;
sr.Close();
------------------------------------------------------------------------
this script is in a button, each time is pressed i want the file recipe2 to be deleted and be copied again from recipe1.
First time i press the button it works fine.. and the file is created and I see the values in the listbox.
But when I press again, the file doesnt get deleted because it says is being use by window viewr.... dont undestand why.. because at the end of the script i put the command sr.close() so the file shouldnt be in use anymore..
any ideas ??
thanks !!
------------------------------------------------------------------------
dim sr as System.IO.StreamReader;
dim readtag as string;
dim line as string;
dim line2 as string;
System.IO.File.Delete("C:\Recipe2.txt");
System.IO.File.Copy("C:\Users\joaco\Documents\workorders\Recipe.txt","C:\Recipe2.txt");
sr = System.IO.File.OpenText("C:\Recipe2.txt");
line = "";
ListBox1.Clear();
while line <> null
line=sr.ReadLine();
line=Stringmid(line,2,20);
if line.Equals("") then
else
ListBox1.AddItem(line);
endif;
endwhile;
sr.Close();
------------------------------------------------------------------------
this script is in a button, each time is pressed i want the file recipe2 to be deleted and be copied again from recipe1.
First time i press the button it works fine.. and the file is created and I see the values in the listbox.
But when I press again, the file doesnt get deleted because it says is being use by window viewr.... dont undestand why.. because at the end of the script i put the command sr.close() so the file shouldnt be in use anymore..
any ideas ??
thanks !!