View Single Post
 
Old March 20th, 2006, 07:31 AM
Thearon's Avatar
Thearon Thearon is offline
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

You are going to have to specify the filename as part of the destination. I ran a little sample which worked fine. Without the filename as part of the destination path, I encountered the same error as you did. Here's my code.

Thearon

Imports System.IO

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strSource As String = "C:\WINDOWS\Greenstone.bmp"
        Dim strDestination As String = "C:\Temp1\" & strSource.Substring(strSource.LastIndexOf("\") + 1)
        File.Copy(strSource, strDestination, True)
    End Sub
End Class