locked
filepath and strings... Whats going on here? RRS feed

  • Question

  • Allright im doing a thing with text files and heres what im doing

    I get a filepath by using FolderBrowserDialog

    In my case its "D:\Testinrdir"

    Then i save the string to a textfile with ioFile.WriteLine

     

    The app reads the textfile fine but then it becomes strange...

     

    If the app read the textfile and finds the path that way it saves it as a string variable named workdir.

    Then when i try to use the string who is correctly shown in a texbox it just doesnt work. It doesnt do any of the stuff written after the line

     

     Dim fileSystemEntries() As String = IO.Directory.GetFileSystemEntries(workdir)

     

    However..

    If i find the same path with the FolderBrowserDialog instead of the textfile it works!.

     

    Im confused and whoever read this post probly is to but i hope someone will understand. =)

     

    Thursday, August 26, 2010 9:34 PM

Answers

  • Wild guess here,

    when read from text file path has a cr or crlf at the end of the path

     

    Thursday, August 26, 2010 10:49 PM
  • Yeah i did make a dumb mistake...

     

    I read the lines into a string with

     

    iolines = iolines & vbCrLf & ioLine

     

    and when i tryed to split em i did

     

    Dim iocontent() = Split(iolines, "vbCrLf")

     

    So it didnt really split the lines at all... No wonder it didnt work

    Friday, August 27, 2010 6:48 AM

All replies

  • Can you post a complete sequence of code showing what you are doing?  Your description sounds odd, so maybe seeing the code in question will help us help you.
     

    --
    Mike
    Thursday, August 26, 2010 9:58 PM
  • Wild guess here,

    when read from text file path has a cr or crlf at the end of the path

     

    Thursday, August 26, 2010 10:49 PM
  • Yeah i did make a dumb mistake...

     

    I read the lines into a string with

     

    iolines = iolines & vbCrLf & ioLine

     

    and when i tryed to split em i did

     

    Dim iocontent() = Split(iolines, "vbCrLf")

     

    So it didnt really split the lines at all... No wonder it didnt work

    Friday, August 27, 2010 6:48 AM
  • Thats the problem with computers; they always do what you tell them.
    …we each have more potential than we might ever presume to guess. (Blog: http://dsmyth.blogspot.com/)
    Friday, August 27, 2010 8:22 AM
  • Hi AlexBorg,

    Welcome to MSDN forums!

    Glad to hear that you figured out your question. Cheers!

    Thank you for your feedback.

    Thank you All for your friendly help.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, September 6, 2010 10:03 AM
    Moderator