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

Discussion in 'ASP .Net' started by Daniel Passwater via DotNetMonster.com, Dec 30, 2004.

  1. 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.

    --
    Message posted via http://www.dotnetmonster.com
     
    Daniel Passwater via DotNetMonster.com, Dec 30, 2004
    #1
    1. Advertising

  2. On Thu, 30 Dec 2004 23:41:12 GMT, Daniel Passwater via DotNetMonster.com
    <> wrote:

    > 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...

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
     
    Craig Deelsnyder, Jan 1, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. amine
    Replies:
    0
    Views:
    393
    amine
    Oct 19, 2003
  2. Asad Khan

    .Net Compact Framework with Visual Studio 2002

    Asad Khan, Sep 25, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    176
    Asad Khan
    Sep 25, 2003
  3. Guest
    Replies:
    1
    Views:
    215
    Jim Blizzard [MSFT]
    Oct 23, 2003
  4. Anil
    Replies:
    1
    Views:
    468
    Jean-Luc David [MS-MVP]
    Jul 31, 2004
  5. Alistair Harrison

    SSL Web Service calls from Compact Framework app

    Alistair Harrison, Jan 12, 2006, in forum: ASP .Net Security
    Replies:
    1
    Views:
    303
    Alistair Harrison
    Jan 12, 2006
Loading...

Share This Page