Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1811427
  • 博文数量: 354
  • 博客积分: 11021
  • 博客等级: 上将
  • 技术积分: 4048
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-24 10:04
文章存档

2020年(1)

2018年(1)

2016年(1)

2015年(2)

2014年(4)

2013年(4)

2012年(12)

2011年(14)

2010年(37)

2009年(34)

2008年(22)

2007年(68)

2006年(102)

2005年(29)

2004年(21)

分类: C#/.net

2014-10-18 18:20:04

Public Function IsFileReady(ByVal filepath As String) As Boolean '检查文件是否正在被使用的函数
If File.Exists(filepath) = False Then
Return True
Exit Function '如果filpath文件不存在,也就不没有被占用,应该返回true
End If
Try
File.Open(filepath, FileMode.Open).Close()
Return True
Catch e As Exception
'MsgBox("Writing was disallowed, as expected: " & e.ToString())
Return False
End Try


End Function

阅读(4838) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~