first i create 1 form, 1 picture box and 1 button..

i name button like upload...when i click upload button, i can browse picture..so after i click a picture,automaticly picture will set in picture box and 1 folder like mypicture will be create on C:// and that picture will be transfer into mypicture folder..

' this for create folder at c:\MyPicture\
If (Not System.IO.Directory.Exists("C:\MyPicture")) Then
    System.IO.Directory.CreateDirectory("C:\MyPicture")
End If

'this for open file in picture box
    Dim OpenFileDialog1 As New OpenFileDialog
    With OpenFileDialog1
        .CheckFileExists = True
        .ShowReadOnly = False
        .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
        .FilterIndex = 2

        If .ShowDialog = DialogResult.OK Then
            ' Load the specified file into a PictureBox control.
            PictureBox1.Image = Image.FromFile(.FileName)
        End If
    End With
	
' this for copying file
If System.IO.File.Exists(SourcePath) = True Then
    File.Copy(SourcePath, DestinationPath, True)
End If

Edited 5 Years Ago by Jx_Man: n/a

where i have to put this code & how to declare SourcePath,DestinationPath & SourcePath

If System.IO.File.Exists(SourcePath) = True Then
File.Copy(SourcePath, DestinationPath, True)
End If

See if this helps with explaining a little about "SourcePath" and "DestinationPath".

If .ShowDialog = DialogResult.OK Then
                ' Load the specified file into a PictureBox control.
                PictureBox1.Image = Image.FromFile(.FileName)
                If IO.File.Exists(.FileName) = True Then '// check if file exists by using the FullPath of the file.
                    IO.File.Copy(.FileName, "C:\MyPicture\" & IO.Path.GetFileName(.FileName), True) '//  IO.File.Copy(SourcePath, DestinationPath, Overwrite)
                    '// IO.Path.GetFileName(.FileName) only gets the FileName and Extension of a file and not the FullPath like when using only ".FileName".
                    MsgBox("File Copy Successful.")
                End If
            End If

SourcePath is the original FullPath of a file and DestinationPath is the new FullPath for the file.

Edited 5 Years Ago by codeorder: n/a

This question has already been answered. Start a new discussion instead.