Illegal characters in path error!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • john20
    New Member
    • Jul 2008
    • 37

    Illegal characters in path error!!

    Hi All,

    I am getting below error, when passing the path which has space between the folder name.

    "System.Argumen tException: Illegal characters in path"


    I have declared the the path in the variable like below:


    Dim sFilename As String = "C:\Test\Window s Service\Schedul e.xml"

    or I have tried like this as well but same error I am getting.

    Dim sSFilename As String = """C:\Test\Wind ows Service\Schedul e.xml"""

    and passing this file name to the below code:

    Code:
    Dim docDataSet As New DataSet
    Dim docReader As New XmlDocument
    Dim xnl As XmlNodeList
    
     docReader.Load(sSchFileName)
     xnl = docReader.SelectNodes("//datetime[text()='" & sDayTime & "']/..")
    Could someone please tell me how to resolve this issue.

    Thanks
    -John
  • R MacDonald
    New Member
    • Mar 2011
    • 24

    #2
    Hello, John,

    Is it possible that the error message is not a consequence of the space in the file name?

    Perhaps if you could post a larger snippet showing both the calling and the called code someone would be able to provide assistance. Also indicating the exact line on which the error occurs would be helpful information.

    Cheers,
    Randy

    Comment

    • bvrwoo
      New Member
      • Aug 2011
      • 16

      #3
      You cannot use '\' slash for directory you must either use '\\' or '/'. '\' is reserved or char text command like '\t' (tab),'\0' (no character) etc... Or use can use the verbatim before the "(text)" which will ignore commands, like @"C\Users\Admin istrator...

      Comment

      Working...