Results 1 to 7 of 7

Thread: copy utility

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    copy utility

    I cannot find a file copy utility in VB 2008(VB.Net)


    it would be the equivilant to:


    SHFileOperation in VB 6

  2. #2
    Lively Member
    Join Date
    Aug 2007
    Posts
    66

    Re: copy utility

    You can use one of these 2 options.
    Code:
    IO.File.Copy("sourceFileName as String", "destinationFileName as String")
    Code:
    My.Computer.FileSystem.CopyFile("sourceFileName as string", "destinationFileName as String")

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: copy utility

    Easiest wway to find stuff is to search the help files/msdn online or search the object browser.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    Re: copy utility

    Quote Originally Posted by Rykler
    You can use one of these 2 options.
    Code:
    IO.File.Copy("sourceFileName as String", "destinationFileName as String")
    Code:
    My.Computer.FileSystem.CopyFile("sourceFileName as string", "destinationFileName as String")

    can you give me an example of how to specify the files & folders?

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

    Re: copy utility

    If you want the user to select the source and destination paths then you would use an OpenFileDialog and SaveFileDialog respectively.
    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

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2003
    Location
    ohio, usa
    Posts
    719

    Re: copy utility

    no, it is only for program use, not a user feature in my App.

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

    Re: copy utility

    Then what more do you need? RonR has already shown you where to specify the source and destination paths. I assume you know what a file path looks like. If you need to specify paths relative to some specific folder then you'd need to let us know what folder that is. That said, you might want to take a look at Application.StartupPath, Environment.GetFolderPath and My.Computer.FileSystem.SpecialDirectories.
    Last edited by jmcilhinney; Nov 24th, 2007 at 08:04 PM.
    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

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