Displaying Images uses up PC memory


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:-


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