?
Solved

Save an image

Posted on 2003-02-23
4
Medium Priority
?
332 Views
Last Modified: 2013-12-25
Dear experts,


I'm now trying to write vb codes to capture the image from the scanner and store it into the file with bmp format.  It has no problem on scanning and storing, but when I open the stored image using picture box or image box, it appears an error message "invalid picture".  But the image file can open with the MS Paint or Imaging.  The related code are as follow:

Private Sub Command1_Click()
ImgScan1.StartScan
End Sub

Private Sub Form_Load()
FileSystem.ChDir ("C:\My Documents\Collector")
Image1.Picture = LoadPicture("temp.bmp")
End Sub

Private Sub ImgScan1_ScanDone()
ImgEdit1.SaveAs "temp.bmp"
Image1.Picture = LoadPicture("temp.bmp")
End Sub

Where ImgScan1 and ImgEdit1 are the components of the Kodak Image Control Lib.
What's wrong with the code?  And how can I load the scanned pictures with the command "LoadPicture()"?
0
Comment
Question by:meteor73
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 8002775
0
 

Expert Comment

by:evanir
ID: 8005861
move ur loadpicture code into clicked event of a button n try. there is nothing worng in ur code. maybe the file system has to be refreshed before loading into the image control.


0
 

Accepted Solution

by:
meteor73 earned 0 total points
ID: 8006414
I have re-write the code, and the result is OK now.  Thank you for your help!!


Private Sub Command1_Click()
ImgScan1.StartScan
End Sub

Private Sub Form_Load()
FileSystem.ChDir ("C:\My Documents\Collector")
Image1.Picture = LoadPicture("temp.bmp")
Picture1.Visible = False
End Sub

Private Sub ImgScan1_ScanDone()
Imgedit1.DrawSelectionRect 0, 0, Imgedit1.ImageWidth, Imgedit1.ImageHeight
Imgedit1.ClipboardCopy
Imgedit1.DrawSelectionRect 0, 0, 0, 0
Picture1.Picture = Clipboard.Paste
SavePicture Picture1.Picture, "temp.bmp"
Imgedit1.FitTo 0
Image1.Picture = LoadPicture("temp.bmp")
End Sub
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9117864
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

762 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