i am using unrar.ocx and getting the filename extracted from it which i am using to move the file extracted to another folder but i am getting the error
"illegal characters found in path"!!!! i debugged it.. what i found was weird is the filename variable have value:
"c:\temp\myfile.txt
with not quote at the end.... my question is ..is there a way to remove all illegal characters in a path to make it correct???
How do you get original string (the path)? Can you post few samples other than what you already did? There could be a null char (Chr(0)) which you need to replace as well.
here is a sample
- choose the .rar file
- select a file extracted from the listbox
- press "copy selected to" to copy selected file to directory of textbox...
i noticed e.g. if i have a file named "myfile.txt" ... and when i copy it to a directory, i get the illegal characters error.... and i see that the source file path is "c:\myfile.txt without the quote at the end... so that made me think that the illegal stuff is after the ".txt" ..somekind of weird illegal invisible characters... so i made this function...
VB Code:
Private Function cleanuppath(ByVal mypath, ByVal fileextension)
this just remove everything found after "c:\myfile.txt"... so the illegal invisible characters are removed... i don't really know why it is like that ..probably that the .ocx was meant primarily for vb6 and not vb.net