C# compact framework: IO problem: app running on PDA can't find file.

  • Thread starter Daniel Passwater via DotNetMonster.com
  • Start date
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.
 
C

Craig Deelsnyder

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.

Would be better posted in the
microsoft.public.dotnet.framework.compactframework group...

AFA question 2, I would ask where are you doing this check? After/at form
load, or during form construction? But I'm purely speculating here and
will leave to the other group to answer...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top