开发者

CopyFile occurs an error

In my program there is a picturebox which contains a logo of company. There is a button named 'Change logo'. When button pressed an open file dialog comes and user can choose different picture for logo. Then i want the program to copy the picture to its current directory. I use this code

            Try
            My.Computer.FileSystem.CopyFile(LogoYolu, My.Computer.FileSystem.CurrentDirectory + "\Logo\logo.bmp", True)
        Catch ex As开发者_如何学Go Exception
            MessageBox.Show(ex.Message)
        End Try

when i run the program the copyfile code occurs an error "The cannot access the file .... because it is beeing used by another process" I trying to solve this for about a day! tried to empty the picturebox before copying, or cop the picture to clipbord... and lots of thing but nothing changed. I have searched social.msdn and all over the net but nothing helped. Can you please share your ideas...


What is 'LogoYolu'? CopyFile src and dest parameters are strings, and of course your application needs to be able to access both the source file and destination directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜