VB   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了VB.Net判断目录或文件是否存在的代码大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load
If Boo_DirExist("F:/dir/") Then
MsgBox("存在F:/dir/目录")
Else
MsgBox("不存在F:/dir/目录")
End If
If Boo_FileExist("F:/file.txt") Then
MsgBox("存在F:/file.txt文件")
Else
MsgBox("不存在F:/file.txt文件")
End If
End Sub

'判断目录是否存在的函数,传入String值,返回Boolean值

Private Function Boo_DirExist(ByVal Str_Path As String) As Boolean
Boo_DirExist = System.IO.Directory.Exists(Str_Path)
End Function

'判断文件是否存在的函数,返回Boolean值

Private Function Boo_FileExist(ByVal Str_File As String) As Boolean Boo_FileExist = System.IO.File.Exists(Str_FilE) End FunctionEnd Class

大佬总结

以上是大佬教程为你收集整理的VB.Net判断目录或文件是否存在的代码全部内容,希望文章能够帮你解决VB.Net判断目录或文件是否存在的代码所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。