how to save

Posted on 2004-11-09
Last Modified: 2010-04-17

i am doing a project in visual basic, in that i am using commondialog control to save a image  in "jpg" format, i am sending you my code below .I am able to save the imagein  "jpg" format and then retrive it in a word document  with the below code.MY Problme is that i want to save the file with out  the save dialogbox appearing but autometically by it self .I think by seeing the below code you may understand my requirement. i had given a comment in the code so that you can easily understand what i require.
HERE is my code that i am using
With cdb
        .DialogTitle = "Choose a filename to save"
        .Filter = "JPEG files (*.JPG)|*.JPG"
        .FilterIndex = 1
        .FileName = "ima"
        .ShowSave ('I dont want this but the file should     be  save autometicall by the above name)
        If .FileName = "" Then Exit Sub
  picBoard.AutoRedraw = True
  picBoard.Picture = picBoard.Image
    SavePicture picBoard.Picture, .FileName
    End With
    'SavePicture picBoard.Picture, "c:\ima.bmp"
sh.Visible = True
 sh.Documents.Open (App.Path & "\pic.doc")
sh.Selection.InlineShapes.AddPicture FileName:=App.Path & "\ima.jpg"
Question by:asatish11
    LVL 85

    Accepted Solution

    You already have the code to do this without the dialog box.  It is commented out:

       SavePicture picBoard.Picture, "c:\ima.bmp"   ' Will save the image to "c:\ima.bmp" without the dialog

    Sadly though, the SavePicture() function does not save in JPG format.  The following line:

       SavePicture picBoard.Picture, "c:\ima.jpg"

    merely saves the image in BMP format with a JPG extension.

    LVL 23

    Assisted Solution

    you could take the following piece of code out :

    .ShowSave ('I dont want this but the file should     be  save autometicall by the above name)

    then insert the rest of the code into a timer and set the timer to like 10000 or however long you want to it save it, so if you wanted it to save the image every 15 seconds then it would be 15000 because it is in milli seconds and one second = 1000.

    You can tweak the coding in the timer to save it to the applications path so it would be

    SavePicture picBoard.Picture, App.Path ' or something like that

    unless you know the exact directory then it will be like you did it before :

    SavePicture picBoard.Picture, "c:\ima.bmp"

    I hope this helps. FYI - Timers have a maximum limit and if you want it more then a certain amount of seconds, you can make your own timer programitcally ;)

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This is an explanation of a simple data model to help parse a JSON feed
    This is about my first experience with programming Arduino.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now