Please help. How could i transfer the image to another location using vb.net?
i've tried this strategy but its not working.
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
fullPath = dlg.FileName 'c:\Sample\image1.jpg
ImageFileName = Path.GetFileName(dlg.FileName) 'image1.jpg filename holder
PathHolder = Path.Combine("d:\FinalLocation", ImageFileName)
.Image = Image.FromFile(fullPath )
.SizeMode = PictureBoxSizeMode.Zoom
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
File.Move(fullPath, PathHolder) 'the 1st try
'System.IO.File.Move(fullPath, PathHolder) '2nd try but its not working at all
thats is so easy. your code is correct but there is 1 line is missing in the save button.
try to add this..
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click picturebox2.image.dispose() File.Move(fullPath, PathHolder) End Sub
I think you cannot move the image to another location because it is still in use by the picturebox. just give it a try :)