Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8060327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:57:02+00:00 2026-06-05T09:57:02+00:00

Hello StackOverflow users. I am trying to create an application where you can browse

  • 0

Hello StackOverflow users. I am trying to create an application where you can browse to a folder, press install button and it will copy some files to the directory of your choosing?
I found some example code but
how do i go on with my code from here? Cant figure out how to copy the files. You can see at last in the code i tried to copy files but its not really working, how do i use the function? I want the files to come from the application directory. And copy to the browsed folder.

Public Class Installer

Private Sub Installer_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub LinkLabel1_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked




End Sub




Private Sub BrowseButton_Click_1(sender As System.Object, e As System.EventArgs) Handles BrowseButton.Click
    ' Declare a variable named theFolderBrowser of type FolderBrowserDialog.
    Dim theFolderBrowser As New FolderBrowserDialog

    ' Set theFolderBrowser object's Description property to
    '   give the user instructions.
    theFolderBrowser.Description = "Please browse to your GTAIV directory."

    ' Set theFolderBrowser object's ShowNewFolder property to false when
    '   the a FolderBrowserDialog is to be used only for selecting an existing folder.
    theFolderBrowser.ShowNewFolderButton = False

    ' Optionally set the RootFolder and SelectedPath properties to
    '   control which folder will be selected when browsing begings
    '   and to make it the selected folder.
    ' For this example start browsing in the Desktop folder.
    theFolderBrowser.RootFolder = System.Environment.SpecialFolder.Desktop
    ' Default theFolderBrowserDialog object's SelectedPath property to the path to the Desktop folder.
    theFolderBrowser.SelectedPath = My.Computer.FileSystem.SpecialDirectories.Desktop

    ' If the user clicks theFolderBrowser's OK button..
    If theFolderBrowser.ShowDialog = Windows.Forms.DialogResult.OK Then
        ' Set the FolderChoiceTextBox's Text to theFolderBrowserDialog's
        '    SelectedPath property.
        Me.FolderTextBox.Text = theFolderBrowser.SelectedPath

    End If
End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles InstallButton.Click

    My.Computer.FileSystem.CopyFile(My.Application.Info.DirectoryPath, theFolderBrowser.SelectedPath)


End Sub
End Class
  • SnoX
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:57:05+00:00Added an answer on June 5, 2026 at 9:57 am

    When you call this line of code

    My.Computer.FileSystem.CopyFile(My.Application.Info.DirectoryPath,  _
                                    theFolderBrowser.SelectedPath) 
    

    the theFolderBrowser object cannot be referenced because it was a local variable inside another method. However, before exiting, you have copied the selected path into a textbox. You could use that textbox as destination of your copy

    My.Computer.FileSystem.CopyDirectory(My.Application.Info.DirectoryPath,  _
                                         Me.FolderTextBox.Text ) 
    

    And also keep in mind that CopyFile copies only one file, if you intend to copy an entire folder you need the CopyDirectory method. There is another important detail in this method:

    If your files exist in the destination directory and you don’t use the overload with the overwrite flag you will get an exception

    My.Computer.FileSystem.CopyDirectory(My.Application.Info.DirectoryPath,  _
                                         Me.FolderTextBox.Text, True ) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello StackOverflow Users, I am new to android and trying to develop a game
Hello Stackoverflow users, I have a question regarding an JQ UI widget im trying
Possible Duplicate: Copy a linked list Hello stackoverflow! I am trying to learn more
Hello stackoverflow community ! I am trying to figure out how to architect my
Hello StackOverflow'ers, I have a (flex) app that, on the click of a button,
Hello people of stackoverflow. I have a problem. I'm trying to set up my
Hello StackOverflow community, Is there any way to open a folder in Windows Explorer
Hello wonderful stackoverflow users. I have a question about url loading. In many browsers
Hello dear users of the stackoverflow! I really like the search form on this
Hello, stackoverflow community! I am working on a rather large database-driven web application. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.