Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

GDI+ generic exception on image operations

Posted on 2006-11-30
2
Medium Priority
?
213 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 2000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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