Solved

GDI+ generic exception on image operations

Posted on 2006-11-30
2
207 Views
Last Modified: 2012-05-05
I'm trying to use the below code, two many things are trying to use the samei mage at once. How can I get this to work. Keep in ind I can't dispose oimage as in this code " EImageDisplay.Image = oImage" the image on the form is set to oimage. Any way to copy this image, to make it work with all the operations?


                    '* Get the response and read the stream
                    Dim oResponse As System.Net.WebResponse = LoginReq.GetResponse
                    Dim oStream As Stream = oResponse.GetResponseStream
                    Dim oStream2 As Stream = oResponse.GetResponseStream
             


                    Dim strRandom As String = Application.StartupPath & "/TEMP/RAN" & Rnd(2342343244) & ".jpg"
                    Dim ImageMD5 As String


                    Dim oImage As Image = Image.FromStream(oStream)
                 
               EImageDisplay.Image = oImage

                  Call oImage.Save(strRandom)



                    ImageMD5 = IMGMD5(strRandom)

0
Comment
Question by:JPERKS1985
2 Comments
 
LVL 10

Accepted Solution

by:
Kinger247 earned 500 total points
ID: 18052887
Have you tried putting a SyncLock around this code ?
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 18054475
That wasn't the issue, it was because the stream was being used in more than one place. Thanks for suggestion though.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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