Solved

GDI+ generic exception on image operations

Posted on 2006-11-30
2
204 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
Comment Utility
Have you tried putting a SyncLock around this code ?
0
 
LVL 1

Author Comment

by:JPERKS1985
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now