更新时间:2023-11-28 10:06:46
来自我的库存库.我想我包含了所有需要的声明.
How to find if the directory is available or not?
Using VB 6.0
databasetext = network path available
If Len(Dir(databasetext)) = False Then
MsgBox "Database Path Not Available"
End if
I am selecting the file from the network path, if the network path is not available, it showing error "bad file name or number"
How to solve this problem?
Need VB 6 code Help
From my stock library. I think I included all the declarations needed.
Private Declare Function FindClose Lib "Kernel32" (ByVal hFindFile As Long) As Long Private Declare Function FindFirstFile Lib "Kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long Private Const INVALID_HANDLE_VALUE = -1 Private Const MAX_PATH = 260 Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Private Type WIN32_FIND_DATA dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Long nFileSizeLow As Long dwReserved0 As Long dwReserved1 As Long cFileName As String * MAX_PATH cAlternate As String * 14 End Type Public Function FolderExists(ByVal FolderSpec As String) As Boolean Dim rst As Long Dim udtW32FindD As WIN32_FIND_DATA Dim lngFHandle As Long Dim strFolder As String 'set to FolderSpec parameter so I can change it strFolder = FolderSpec If Right$(strFolder, 1) <> "\" Then strFolder = strFolder & "\" End If strFolder = strFolder & "*" 'add the wildcard allows finding share roots lngFHandle = FindFirstFile(strFolder, udtW32FindD) If lngFHandle INVALID_HANDLE_VALUE Then Call FindClose(lngFHandle) FolderExists = True End If End Function