how to save


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"
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shane Russell2nd Line Desktop SupportCommented:
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 ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.