Results 1 to 3 of 3

Thread: [RESOLVED] Help with selecting directory

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2008
    Location
    Dominican Republic
    Posts
    733

    Resolved [RESOLVED] Help with selecting directory

    Heyy! I have a small question regarding selecting directories... If I have my folder in "...\Desktop\My Folder", and in my folder i have 3 other ones named A, B, C... How can I make the program save a file named "Cheese.txt" in the "C"-named folder? Or if its a file named "123.txt" to save it in a random folder?

    Thanks in advanced!
    "In our profession, precision and perfection are not a dispensable luxury, but a simple necessity."
    Niklaus E. Wirth


    Rate any post that helped you, it's a good way of saying thanks
    Please specify your Visual Studio Version!

    Why rating is useful

    My Code Bank Submissions: How to determine Windows Version| Working With Mouse Events | Blocking Input Using API | Get host's IP | Minimize to system tray "animated" | Colored ListBox (custom fonts, colors, highlight) Updated -New Class! | [VS 2008] Strong encryption and hashing class - Updated! 31/August/2009 | Create a shortcut using IWshRuntimeLibrary

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Help with selecting directory

    To get to your desktop folder and other special folders you can use properties of My.Computer.FileSystem.SpecialDirectories object. They will always give you the correct path no matter what system you're on. To save a file to a particular folder you simply specify the full file path including that folder.

    When you're talking about anything random you talking about using an instance of the Random class to generate a random number. You can then use that number in whatever way you see fit. In your case you'd put your folder paths into an array or collection and then use the random number as an index to select one of the paths.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2008
    Location
    Dominican Republic
    Posts
    733

    Re: Help with selecting directory

    That's it! Thanks a lot!
    "In our profession, precision and perfection are not a dispensable luxury, but a simple necessity."
    Niklaus E. Wirth


    Rate any post that helped you, it's a good way of saying thanks
    Please specify your Visual Studio Version!

    Why rating is useful

    My Code Bank Submissions: How to determine Windows Version| Working With Mouse Events | Blocking Input Using API | Get host's IP | Minimize to system tray "animated" | Colored ListBox (custom fonts, colors, highlight) Updated -New Class! | [VS 2008] Strong encryption and hashing class - Updated! 31/August/2009 | Create a shortcut using IWshRuntimeLibrary

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