Results 1 to 7 of 7

Thread: Updating String() va;ues

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    133

    Updating String() va;ues

    I have a program that get all files in a directory and puts them in a string(). Each one of these files are renamed. How can I update or replace the value in the string() with the new name?

    Thank You

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,134

    Re: Updating String() va;ues

    Your description is too vague. Please provide a FULL and CLEAR explanation of the problem. What does this actually mean:
    Each one of these files are renamed.
    Are you saying that you're renaming the files in the application or that they are being renamed outside the application? If it's within then your question boils down to how to set an element of an array, which is not something you have to ask us. If it's outside then you can simply discard the array you already have and create a new one in the same way, which is not something you have to ask us about. If you specifically want to modify the existing array then you would have to know the mapping from old file names to new ones. Do you know that, because you haven't told us what it is or how you can determine it programmatically, so how could we tell you how to use it programmatically? Basically, we can't tell whether you're asking something so simple that you shouldn't need to ask or something for which you haven't provided enough information.

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,369

    Re: Updating String() va;ues

    Actually it's not even clear whether he's talking about a string array or a list. @Tesla 1886: Could you provide some code so that we can see what you're trying to do?

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,134

    Re: Updating String() va;ues

    Quote Originally Posted by Peter Swinkels View Post
    Actually it's not even clear whether he's talking about a string array or a list.
    I'm OK with that part. String() is the data type for a String array, plus the Directory.GetFiles method returns a String array, so it seems a safe bet that it's an array.

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    24,033

    Re: Updating String() va;ues

    So, you loop through your string array, changing every filename? Why not also change the string array element at that point? Don't use a For Each loop...

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    133

    Resolved Re: Updating String() va;ues

    I figured it out. I swear I tried it in a similar program and got an error.

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,134

    Re: Updating String() va;ues

    And we still don't know what you were trying to do or what you did, so this whole thread was pointless as it won't help anyone else either.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width