Link to home
Start Free TrialLog in
Avatar of Member_2_6479049
Member_2_6479049

asked on

How to save a picture box in a specific network folder using vb.net 2013

I'm trying to save the picture box to a folder in a network, this code works fine but the pic is save in MyComputer but I need to save it a this path \\Extlansbs09\Scrh_Fotos

The

        Dim ImageDialogue As OpenFileDialog = New OpenFileDialog()
        Dim cFileName As String = cgClavePersona

        ImageDialogue.Title = "Seleccione la foto"
        ImageDialogue.InitialDirectory = "\\Extlansbs09\Scrh_Fotos\"
        ImageDialogue.Filter = "Image Files|*.gif;*.jpg;*.png;*.bmp;"
        ImageDialogue.RestoreDirectory = False

        If ImageDialogue.ShowDialog() = DialogResult.OK Then
            FotoTit.Image = Image.FromFile(ImageDialogue.FileName)
        End If

        If Me.FotoTit.Image IsNot Nothing Then
            Me.FotoTit.Image.Save(IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyPictures, cFileName & ".jpg"))
        End If

Open in new window


Can you guys help me please!
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_6479049
Member_2_6479049

ASKER

Miguel Thank you

I'm having this error:

An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll

Additional information: A generic error occurred in GDI+.
Q1. What kind of class is the Image instance (FotoTit.Image)?
Q2. If it is your own code can you post the code?
IF it is  a third party there is nothing you can do about it, unless you consider save a temp file locally and then copy that file to the network location.
Good morning Miguel,

The images i'm using are 'jpg' and the code is this

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim ImageDialogue As OpenFileDialog = New OpenFileDialog()
        Dim cNombreArchivo As String = cgClavePersona

        ImageDialogue.Title = "Seleccione la foto"
        ImageDialogue.InitialDirectory = "\\Extlansbs09\Scrh_Fotos\"
        ImageDialogue.Filter = "Image Files|*.gif;*.jpg;*.png;*.bmp;"
        ImageDialogue.RestoreDirectory = False

        If ImageDialogue.ShowDialog() = DialogResult.OK Then
            FotoTit.Image = Image.FromFile(ImageDialogue.FileName)
        End If

        If Me.FotoTit.Image IsNot Nothing Then
            Me.FotoTit.Image.Save(IO.Path.Combine("\\Extlansbs09\Scrh_Fotos\", cNombreArchivo & ".jpg"))
        End If

    End Sub

Open in new window

Alex,

It was solved, there was an error in our dns server and once is fixed, the pic was saved!!!

Thank you so much Alex.
Excelent help!!!

Thank you so much.
No worries, I had my fair share of DNS issues myself. Cheers M