the thing is, in the code block
while ((currentLine = sr.ReadLine()) != null)
{
MessageBox.Show(currentLine);
textBox2.Text = currentLine;
string destinationPath = @"c:\Raj\log";
string fileToMove = abcd;
string moveTo = destinationPath;
File.Move(fileToMove, moveTo);
MessageBox.Show("file moved");
}
you read one line, then even before reading second line, you try to move the file. I advise to relocate the lines
string destinationPath = @"c:\Raj\log";
string fileToMove = abcd;
string moveTo = destinationPath;
File.Move(fileToMove, moveTo);
MessageBox.Show("file moved");
out of the while block:
while ((currentLine = sr.ReadLine()) != null)
{
MessageBox.Show(currentLine);
textBox2.Text = currentLine;
}
sr.Close();
string destinationPath = @"c:\Raj\log";
string fileToMove = abcd;
string moveTo = destinationPath;
File.Move(fileToMove, moveTo);
MessageBox.Show("file moved");