-
Hi everyone, susspected easy one this.
I am doing a backup app. the user selects a drive from the dirlistbox function, & the resulting directory is put into a text box (which changes with the dirlistbox option selected).
Right, I noticed then, that the textbox does not show a "\" after the text, ie c and not C\.I am using the fso.copyfile method & need that \ in, so Ok I wrote :
TxtBox1.text = Dir1.path & "\" on the dirlistbos click event.
My question, after all of that, is because I get C\\ if the user selects a drive & not a folder. Instead of a very long if-then statement to go through drives a-z, is there another way I can just put in the \ if it's a folder & not a drive?
(Hope I made sense there);)
Thank you,:D
Alex Read
VB6 Learning Edition & SP4
:confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused:
-
Use something like this:
Code:
Function NormalisePath(strPath As String) As String
If Right(strPath, 1) = "\" Then
NormalisePath = strPath
Else
NormalisePath = strPath & "\"
End If
End Function
-
EXCELLENT
Cannot thank you enough for that, I dread to think of the time if would have taken me otherwise,
If txt <> "A:\"
If txt <> "B:\"
Etc upto Z!
You have been a great help, and responded very quickly, thank you!
Alex Read
:p :p :cool: :cool: :cool: :D :D :D :D :D :D :cool: :cool: :cool: :p :p