[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Save an image

Posted on 2003-02-23
4
Medium Priority
?
336 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
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

612 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