I have the following code:
Private Sub LoadImageList()
Dim il As New ImageList
Dim di As New DirectoryInfo(I mgDir)
For Each fi As FileInfo In di.GetFiles
Dim bmp As Image = DevIL.DevIL.Loa dBitmap(fi.Full Name)
PictureBox1.Ima ge = bmp
il.Images.Add(f i.FullName, PictureBox1.Ima ge)
Next
ImgList.LargeIm ageList = il
End Sub
Even though the PictureBox can display the image, I get the following error
when trying to add the image to the ImageList.
"Image added to an ImageList must either derive from Image or be an Icon."
How can I fix this?
Thanks.
Private Sub LoadImageList()
Dim il As New ImageList
Dim di As New DirectoryInfo(I mgDir)
For Each fi As FileInfo In di.GetFiles
Dim bmp As Image = DevIL.DevIL.Loa dBitmap(fi.Full Name)
PictureBox1.Ima ge = bmp
il.Images.Add(f i.FullName, PictureBox1.Ima ge)
Next
ImgList.LargeIm ageList = il
End Sub
Even though the PictureBox can display the image, I get the following error
when trying to add the image to the ImageList.
"Image added to an ImageList must either derive from Image or be an Icon."
How can I fix this?
Thanks.
Comment