I'm trying to copy a chosen file to a directory under 'C:\example' directory folder, I have a textbox to store the address (path) to the selected file, a OpenFileDialog to enable the user to browse to the file to copy and also a FolderBrowserDialog which let the user browse the folder he would like to copy. There are 2 radiobuttons which are for determining which tool to use for browsing between the Folder and a File Dialog so the first radiobutton if it checked the system will use the OpenFileDialog and if the RadioButton2 is checked then the system will us the FolderBrowserDialog. I have two buttons the first button is for browsing which works fine and the second button is for copying the chosen file to 'C:\example' so now when I try to copy it just produce this error
"Could not complete operation since a directory already exist in the path 'C:\example'."
The folder example is created by this program on a first time execution so I don't want to delete it because it may contain the user files which the user has copied so I want to add item to the folder. Here is the code I'm using:
If My.Computer.FileSystem.DirectoryExist("C:\example" Then
' This produced the above error and I tried to swap around like below and I got the following error.
' Note that below I commented the above code of copying a file to use the below.
Dim Dest As String = "C:\example"
I then get this error " The target file 'C:\example' is a directory, not a file."
Sorry for not formating the codes I'm using a mobile phone.