D
Daniel Passwater via DotNetMonster.com
I've checked the file directory, and it's right. I was putting a ".txt" on the end, but someone told me that .txt is added automatically. They said that it would cause a redundancy. (i.e filename.txt.txt)
private void CheckForFile()
{
// Set directory path.
string directory = "\\My Documents\\UploadAmmoCards\\AC" +
MainOperations.AMU_SN;
// DirectoryInfo dirInfo = new DirectoryInfo(directory);
// If file does not exist
if (!File.Exists(directory))
{
MessageBox.Show(directory);
MessageBox.Show("ERROR: The file can not be found. " +
"The upload can not be processed.");
this.Close();
}
}
I have a second problem with the Close(). It gives me an ObjectDisposedException. If I handle that with a try/catch, It gives me an IO exception. Is there a reason that I can't close the form without finishing. I'm using it almost like a break.
private void CheckForFile()
{
// Set directory path.
string directory = "\\My Documents\\UploadAmmoCards\\AC" +
MainOperations.AMU_SN;
// DirectoryInfo dirInfo = new DirectoryInfo(directory);
// If file does not exist
if (!File.Exists(directory))
{
MessageBox.Show(directory);
MessageBox.Show("ERROR: The file can not be found. " +
"The upload can not be processed.");
this.Close();
}
}
I have a second problem with the Close(). It gives me an ObjectDisposedException. If I handle that with a try/catch, It gives me an IO exception. Is there a reason that I can't close the form without finishing. I'm using it almost like a break.