ocbeta
Member
I get the following error:
A first chance exception of type System.OutOfMemoryException occurred in system.drawing.dll
Additional information: Out of memory.
On this line of code in the debuger:
Dim imgImage As Bitmap = Bitmap.FromFile(strPath)
I have tried disposing the image object. imgImage.Dispose()
Then I just get an error on the Form1 Public Class definition.
Also I have tried setting the variable imgImage = Nothing etc.
I am very stumped at this point.
Thanks for the help.
A first chance exception of type System.OutOfMemoryException occurred in system.drawing.dll
Additional information: Out of memory.
On this line of code in the debuger:
Dim imgImage As Bitmap = Bitmap.FromFile(strPath)
Code:
Try
Dim imgImage As Bitmap = Bitmap.FromFile(strPath)
ImageList1.Images.Add(imgImage)
Dim pic As New PictureBox()
imgImage = imgImage.GetThumbnailImage(50, _
50, Nothing, Nothing)
pic.Image = imgImage
pic.Dock = DockStyle.Top
Panel2.Controls.Add(pic)
GC.Collect()
strPath = Nothing
Catch err As System.Exception
System.Windows.Forms.MessageBox.Show(err.Message)
End Try
I have tried disposing the image object. imgImage.Dispose()
Then I just get an error on the Form1 Public Class definition.
Also I have tried setting the variable imgImage = Nothing etc.
I am very stumped at this point.
Thanks for the help.