in the main loop, i was getting the image from sql with this
Dim imageData As Byte() = DirectCast(SqlcmdImage.ExecuteScalar(), Byte())
If Not imageData Is Nothing Then
Using ms2 As New MemoryStream(imageData, 0, imageData.Length)
ms2.Write(imageData, 0, imageData.Length)
frmImportImages.PicNormal.background= Image.FromStream(ms2)
ms2.Dispose()
End Using
End If
I then changed the
frmImportImages.PicNormal.background= Image.FromStream(ms2)
to
frmImportImages.PicNormal.image = Image.FromStream(ms2)
And i've got no more memory errors. thanks everyone for your input, much appreciated, can't believe it was something so small that i had to change.