When are you getting this error? At compile time? You may need to
explicitly cast the image you get an Icon object (if you have Option strict
on), or it may be that it is not an icon, but some other format of image.
Try doing something like this and see what you get;
Dim MyImage As Image
Dim MyIcon As Icon
MyImage = Me.ImageList1.Images(0)
If SrcOverlay.RawFormat.Equals(Drawing.Imaging.ImageF ormat.Icon) Then
MyIcon = DirectCast(SrcOverlay, Drawing.Icon)
' Place icon into statusbar here
Else
MessageBox.Show("Not an Icon")
End If
BTW - not sure if this is the best way to check an image is actually an
icon, if there's a better way can someone shout?
Jon
"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader0.news.skynet .be...
Hi
I'm having trouble getting icons from an imagelist in a statusbar panel.
if i load the icons directly it works
Dim ico As new Icon("W95MBX03.ICO")
statusbarPanel..Icon = ico
but if i try to set the icon property with an imagelist i get this
Value of type 'System.Drawing.Image' cannot be converted to
'System.Drawing.Icon'
If anyone has a thought, pls let me know.
tnx in advance
--
Juchtmans Eric
Omnipack