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.
精彩评论