try
{
using(FileStream fs = File.OpenWrite(strFileName)
{
if(fs == null)
return;
}
}
catch(UnauthorizedAccessException e)
{
}
or Else, Try this!!!
public bool FileIsLocked(string strFullFileName) {
bool blnReturn = false;
System.IO.FileStream fs;
try {
fs = System.IO.File.Open(strFullFileName, IO.FileMode.OpenOrCreate, IO.FileAccess.Read, IO.FileShare.None);
fs.Close();
}
catch (System.IO.IOException ex) {
blnReturn = true;
}
return blnReturn;
}