Skip to main content

Hi,

I display images on a windows form using the following code:-

set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)

However if this form is repeatedly loaded displaying different images the pc memory goes up and up until eventually i see an out of memory error.

So found this:-

http://msdn.microsoft.com/en-us/library/system.drawing.image.dispose(v=vs.90).aspx

Which I assume gets converted into cobol code as follows:-

invoke self::"Dispose"()

Which I put straight after the "set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)" line.

Is that correct and will it have any other effect?

Kind regards

Neil.

Hi,

I display images on a windows form using the following code:-

set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)

However if this form is repeatedly loaded displaying different images the pc memory goes up and up until eventually i see an out of memory error.

So found this:-

http://msdn.microsoft.com/en-us/library/system.drawing.image.dispose(v=vs.90).aspx

Which I assume gets converted into cobol code as follows:-

invoke self::"Dispose"()

Which I put straight after the "set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)" line.

Is that correct and will it have any other effect?

Kind regards

Neil.

Hi Neil,

You should not dispose of the image until it is no longer in use so I would recommend adding the Dispose when you close the form. The syntax would be

invoke picView::"Image"::"Dispose"()

By the way, are you aware that the quotes around the method names are no longer required in Visual COBOL ?

Hope that helps,

Gael


Hi,

I display images on a windows form using the following code:-

set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)

However if this form is repeatedly loaded displaying different images the pc memory goes up and up until eventually i see an out of memory error.

So found this:-

http://msdn.microsoft.com/en-us/library/system.drawing.image.dispose(v=vs.90).aspx

Which I assume gets converted into cobol code as follows:-

invoke self::"Dispose"()

Which I put straight after the "set picView::"Image" to type "System.Drawing.Image"::"FromFile"(ws-string)" line.

Is that correct and will it have any other effect?

Kind regards

Neil.

Hi Gael,

Thats greats many thats for info and yes but there are a few reasons why I still use quotes.

Kind regards

Neil.