Private Sub BTN_LOAD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesBTN_LOAD.Click
'文件夹
CHECK
If Not blnDirExist(TXT_PATH.Text.Trim) Then
MsgBox("文件夹路径不存在")
BTN_LOAD.Focus()
Exit Sub
End If
'文件
CHECK
If Not blnFileExist(TXT_PATH.Text.Trim) Then
MsgBox("文件不存在")
BTN_LOAD.Focus()
Exit Sub
End If
End Sub
#Region "文件夹存在CHECK"
Private Function blnDirExist
(ByVal strPath As String) As Boolean
Dim strDirTemp As String()
strDirTemp
= strPath.Split("\")
strPath = String.Empty
For i As Integer =
0 To strDirTemp.Length – 2
strPath
+= strDirTemp(i) & "\"
Next
blnDirExist = System.IO.Directory.Exists(strPath)
End Function
#End Region
#Region "文件存在CHECK"
Private Function blnFileExist
(ByVal strFile As String) As Boolean
blnFileExist = System.IO.File.Exists(strFile)
End Function
#End Region