how can i save an image from image box

vb6 Turkey
  • 12 years ago

    please help ! 

    how can i save an image from image box to  window  folder. i want to copy this  image from image box to window  folder.

  • 12 years ago

    Try using Commondialog box to make a copy

    Project>components> Windows Common Dialog Control 6.0 (SP6)

    Commondialog1.Filter = "JPEG Files (*.jpg)|*.jpg"
    Commondialog1.Showsave 'Save As Dialog

     

     

     


     

  • 12 years ago

    Please Help Me Again! 

     Private Sub Image1_Click()
    CommonDialog.ShowOpen
    Image1.Picture = LoadPicture(CommonDialog.FileName)
    End Sub
    Private Sub cmdSaveImage_Click()

    'Help me coding for this Command Button 

    'When i press SaveImgae button
    'I want to save or copy that image from ImageBox to Window Folder
    'Example.....Save that image to C:\MyPhoto
    End Sub

  • 12 years ago

     ok.. this is it...

    Dim srcFilename As String 

    Private Sub cmdBrowsePicture_Click()
        Me.CommonDialog1.Filter = "JPEG FIle (*.jpg)|*.jpg"
        Me.CommonDialog1.ShowOpen
        Me.Image1.Picture = LoadPicture(CommonDialog1.Filename)
        srcFilename = CommonDialog1.Filename
    End Sub

    Private Sub cmdSavePicture_Click()
        Me.CommonDialog1.Filter = "JPEG FIle (*.jpg)|*.jpg"
        Me.CommonDialog1.ShowSave
        Call FileCopy(srcFilename, CommonDialog1.Filename)
    End Sub

    Note: FileCopy is a visual basic keyword..

  • 12 years ago

    Dear Fri Please help again

     Dim I, K As String

    Private Sub cmdSaveImage_Click()
    CDC.Filter = "JPEG Files(*.jpg)|*.jpg"
    CDC.ShowSave

    ' when Save As dialog box appear , may i disable file name field
    Call FileCopy(I, K) ' and i want to copy image with my  constant destination file name

    'eg. Text1.text instead of CDC.Filename
    End Sub

    Private Sub Command1_Click()
    Unload Me
    End
    End Sub

    Private Sub Img_Click()
    CDC.Filter = "JPEG Files(*.jpg)|*.jpg"
    CDC.ShowOpen
    Img.Picture = LoadPicture(CDC.FileName)
    I = CDC.FileName
    K = Text1.Text
    End Sub

  • 12 years ago

    ok.. i think you dont want to use commondialog control for saving image.. heres another way, i hope this will solve your problem 

    This code is working but make sure that filename that you will input in textbox must have a valid path and valid image format. 

    Private Sub cmdBrowsePicture_Click()
        Me.CommonDialog1.Filter = "JPEG File (*.jpg)|*.jpg"
        Me.CommonDialog1.ShowOpen
        Me.Image1.Picture = LoadPicture(CommonDialog1.Filename)
    End Sub

    Private Sub cmdSavePicture_Click()
        Call SavePicture(Image1.Picture, Text1.Text)
    End Sub

    Note:

    Text1.Text= is your new filename consist of (Directory,Foldername,Filename,and file extention/format)

    e.g. Text1.text="C:\MyPhoto\myPicture.jpg"

    SavePicture is a visual basic Keyword 

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray