如何用vb.net实现:判断指定路径下是否存在指定文件
答案:3 悬赏:50 手机版
解决时间 2021-11-11 12:03
- 提问者网友:溺爱和你
- 2021-11-11 05:28
如何用vb.net实现:判断指定路径下是否存在指定文件
最佳答案
- 五星知识达人网友:罪歌
- 2021-11-11 05:47
Dim objFile As System.IO.File
If objFile.Exists("C:\a.txt") Then
MsgBox("存在")
Else
MsgBox("不存在")
End If
If objFile.Exists("C:\a.txt") Then
MsgBox("存在")
Else
MsgBox("不存在")
End If
全部回答
- 1楼网友:人類模型
- 2021-11-11 07:24
Dir函数, Dir("C:\a.txt"), 如果存在, 返回"C:\a.txt"
如果不存在, 返回""
如果不存在, 返回""
- 2楼网友:渊鱼
- 2021-11-11 07:02
VB.NET应该是这个函数
exists
Dim a As String = "C:\A.txt"
Dim f As New IO.FileInfo(A)
If f.Exists = True Then
MsgBox("存在")
Else
MsgBox("不存在")
End If
exists
Dim a As String = "C:\A.txt"
Dim f As New IO.FileInfo(A)
If f.Exists = True Then
MsgBox("存在")
Else
MsgBox("不存在")
End If
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯