dannytan
March 12th, 2003, 10:39 PM
hi all. i am currently writing a simple program. in my program, before the form loads, i would need to determine if a file named "abc.mdb" exists in the current directory of the running program. so below is what i did:
private void MainFrm_Load(object sender, System.EventArgs e)
{
string curDir = Directory.GetCurrentDirectory();
FileInfo fi = new FileInfo(curDir+"\\Abc.Mdb");
string fp = fi.FullName;
if(fi.Exists == false)
{
MessageBox.Show("System file Abc.Mdb is not found.", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
else
{
}
}
The problem is that EVEN the file EXISTS in the current directory fi.Exists is still false. Can anyone help? Thanks.
private void MainFrm_Load(object sender, System.EventArgs e)
{
string curDir = Directory.GetCurrentDirectory();
FileInfo fi = new FileInfo(curDir+"\\Abc.Mdb");
string fp = fi.FullName;
if(fi.Exists == false)
{
MessageBox.Show("System file Abc.Mdb is not found.", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
else
{
}
}
The problem is that EVEN the file EXISTS in the current directory fi.Exists is still false. Can anyone help? Thanks.