Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm Using WIA Layer Sample in my machine for a educational purpose. But it gives me following Error In Visual Basic 2008. Error Shown on this code


VB
Picture1.BackgroundImage = img.ARGBData.Picture(w, h)


Error Is this

Unable to cast COM object of type 'System.__ComObject' to class type 'System.Drawing.Image'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Posted

You obviously have an error in the img.ARGBData.Picture(w, h) call. Are you sure it returns a System.Drawing.Image? If not, perhaps you need to figure out what this method returns and then figure out how to cast this return value to a System.Drawing.Image.
Without any more information in your question, you won't get a much better answer.
 
Share this answer
 
Than's Marcus this helps me
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900