Solved

GDI+ generic exception on image operations

Posted on 2006-11-30
2
208 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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