How can I check a valid path?` 
Author Message
 How can I check a valid path?`

Hi

        How can I check a path is valid?
        For example, a user input "c:\test\test1"
        How can I check the path is valid or not?

        Thanks a lot !

Derek



Tue, 03 Jul 2001 03:00:00 GMT  
 How can I check a valid path?`
Use GetLongPathName() API or Dir() function
Declare Function GetLongPathName Lib "kernel32" Alias "GetLongPathNameA"
(ByVal lpsPath As String, ByVal lplPath As String, ByVal nBuffer As
Long) As Long

comm

Quote:
> Hi

>         How can I check a path is valid?
>         For example, a user input "c:\test\test1"
>         How can I check the path is valid or not?

>         Thanks a lot !

> Derek



Tue, 03 Jul 2001 03:00:00 GMT  
 How can I check a valid path?`
Hi Derek. Here is the code:

Dim myPath as String
myPath = "c:\test\test1"
if Dir(mPath) = "" then
   'myPath is NOT valid
else
   'myPath is valid
End If

Mike

Quote:

> Hi

>         How can I check a path is valid?
>         For example, a user input "c:\test\test1"
>         How can I check the path is valid or not?

>         Thanks a lot !

> Derek

--
                       \\~ ~//

        ----------o00o-(_)-o00o-------------


ICQ # 8170125
----



Tue, 03 Jul 2001 03:00:00 GMT  
 How can I check a valid path?`
Try to create a file in the path
Quote:

>Hi

> How can I check a path is valid?
> For example, a user input "c:\test\test1"
> How can I check the path is valid or not?

> Thanks a lot !

>Derek



Wed, 04 Jul 2001 03:00:00 GMT  
 How can I check a valid path?`
for verifying files try:

 If Dir("c:\test\test1") = "c:\test\test1" Then
      ' file exists.
elseif
  Dir("c:\test\test1") = ""
      'file doesn't exist
end if

for verifying directories try:

If Dir("c:\test\test1", vbDirectory) = "" Then
       MkDir "c:\test\test1"
end if

Chuck

Quote:

>Try to create a file in the path


>>Hi

>> How can I check a path is valid?
>> For example, a user input "c:\test\test1"
>> How can I check the path is valid or not?

>> Thanks a lot !

>>Derek



Wed, 04 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Check for valid path in class Property Let

2. Run-time error `-2147467259 (80004005)`: ...................when opening Word2000

3. VB5 Database, "Not a valid path"

4. Valid file path name

5. DIR command / valid path

6. Packaging and Deployment - Not a valid path problem

7. Method for checking for valid dates in a query

8. Check if a date field is valid

9. Check for valid file or directory

10. Checking if string contains valid GUID

11. Check for valid user

 

 
Powered by phpBB® Forum Software