A general method for file copying, based on what you have, would look something like this:
bool FileCopy(string path1, string path2)
{
try
{
using (FileStream readFileStream = new FileStream(path1, FileMode.Open, FileAccess.Read))
{
using (StreamReader streamReader = new StreamReader(readFileStream))
{
using (FileStream writeFileStream = new FileStream(path2, FileMode.Create, FileAccess.Write))
{
using (StreamWriter streamWriter = new StreamWriter(writeFileStream))
{
string line;
while ((line = streamReader.ReadLine()) != null)
{
streamWriter.WriteLine(line);
}
}
}
}
}
return true;
}
catch
{
return false;
}
}
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)