日期:2014-05-20  浏览次数:20969 次

winfrom读取excel前判断excel是否已经打开
winfrom读取excel前判断excel是否已经打开,已经打开的话会报错所以判断一下打开就提示终止了

------解决方案--------------------
try
{
   Stream s = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.None);

   s.Close();

   return true;
}
catch (Exception)
{
   return false;
}
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/