Solved

GDI+ generic exception on image operations

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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