文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>VB.Net判断目录或文件是否存在的方法

VB.Net判断目录或文件是否存在的方法

时间:2010-12-23  来源:nieyangjie

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("C:\Lob.cn\") Then
            MsgBox("存在C:\Lob.cn\目录")
        Else
            MsgBox("不存在C:\Lob.cn\目录")
        End If
        If Boo_FileExist("C:\Lob.txt") Then
            MsgBox("存在C:\Lob.txt文件")
        Else
            MsgBox("不存在C:\Lob.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

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

    Private Function Boo_FileExist(ByVal Str_File As String) As Boolean

        Boo_FileExist = System.IO.File.Exists(Str_File)

    End Function

End Class

相关阅读 更多 +
排行榜 更多 +
Titanite

Titanite

飞行射击 下载
果冻冲冲冲最新版

果冻冲冲冲最新版

休闲益智 下载
怪物卡车跳跃

怪物卡车跳跃

休闲益智 下载