?
Solved

how to save

Posted on 2004-11-09
4
Medium Priority
?
288 Views
Last Modified: 2010-04-17
hai

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.Refresh
  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"
0
Comment
Question by:asatish11
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 252 total points
ID: 12536219
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.

~IM
0
 
LVL 23

Assisted Solution

by:gecko_au2003
gecko_au2003 earned 248 total points
ID: 12537244
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 ;)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
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 …
Introduction to Processes

839 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