unbelievable..?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi all,

I recently built a small prototype smart device project with C# under
VS2005 SP1, and was surprised to see that a 'trivial' statement
did not work to be able to verify the existence of a file that I had created

i.e. System.IO.File.Exists(filename)

I verified the existence of the file by getting a command prompt window and
issuing a dir command. i.e. dir c:\train.zip

Can someone please let me know what can be wrong?

Thanks,

Carlos.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Data.SqlServerCe;

namespace mything

{

public partial class Form1 : Form

{

//private System.Windows.Forms.MainMenu mainMenu1;

string filename = @"C:\train.zip";

public Form1()

{

InitializeComponent();

}

private void DeleteDB()

{

try

{

if (System.IO.File.Exists(filename)) //does not find it %$#@!

{

System.IO.File.Delete(filename);

}

}

catch (Exception ex)

{

;

}

}

private void Form1_Load(object sender, EventArgs e)

{

DeleteDB();

}

}






.



Relevant Pages