In my app i display an image, i provide an browse for a new picture button.
This feature will copy the file from the users choosen directory and copy it and place
it into a specific directory.
The problem imhaving is the image i want to replace is in use by the app and wont change.
i use picturebox.dispose() to free up the image in memory but it doesnt seem to work.
'Completed
Sub SaveImage(ByVal movieDirectory, ByVal imageType)
Dim fileDlg As New System.Windows.Forms.OpenFileDialog
Dim filePath As String
fileDlg.Title = "Please Select Poster Location"
fileDlg.InitialDirectory = "C\Pictures:"
fileDlg.Filter = "JPEG Images (*.jpg,*.jpeg)|*.jpg;*.jpeg"
If fileDlg.ShowDialog() = DialogResult.OK Then
'Get seleted file path
filePath = fileDlg.FileName
If IO.File.Exists(filePath) Then
'Change name
Dim posterName() As String
posterName = filePath.Split("\")
'Create new file path
Dim newPosterPath = String.Concat(movieDirectory, "\frontCover.jpg")
Dim newBackdropPath = String.Concat(movieDirectory, "\Bkdrop.jpg")
'Move and rename file
If imageType = "poster" Then
'free up image
Form1.posterPictureBox.Image.Dispose()
'Copy image
System.IO.File.Copy(filePath, newPosterPath, True)
Else
'free up image
Form1.backdropPictureBox.Image.Dispose()
'Copy image
System.IO.File.Copy(filePath, newBackdropPath, True)
End If
'Reload image
FindImages(movieDirectory)
End If
End If
fileDlg.Dispose()
End Sub
Any help world be great

New Topic/Question
Reply



MultiQuote





|