
Check for valid path in class Property Let
Hi John
Thanks for responding. You brought up a very good point, the programmer may
or may not be able to guarantee that the sting contents is a pathname
appropriate to the function to be called and it should be checked.
Quote:
> If Right(strValue, 1) <> "\" Then strValue = strValue & "\"
I did have a problem here, in that, the trailing backslash has to be removed
(instead of added) for Dir$() to work though.
I've tested it with:
MsgBox Dir$("C:\Program Files\", vbDirectory)
Returns a null string
MsgBox Dir$("C:\Program Files", vbDirectory)
Returns "Program Files"
There is also the issue of adding an else clause to the routine for
situations where this property may be set more than once in the same
instance. In that case the else would look after setting the property to a
null string if an incorrect or non-existing path was passed ... and the
programmer would trap for it :-)
--
Dave Keighan
VB - A Grey Matter Universal Gym