ImageList on windows form UserControl

  • Thread starter Thread starter DK
  • Start date Start date
D

DK

I have an image list control on a user control that I'm trying to access
from the main form. I've tried different code but can't get it. I get an
error: Cannot convert type 'System.Windows.Forms.Control' to
'System.Windows.Forms.ImageList'

ImageList il = new ImageList();
il = (ImageList)userControlMedia1.Controls.Find("imageListMedia", true);

Any ideas??
 
Change the modifier of the imagelist control on the usercontrol to
Internal or Public and then use the following to access:

ImageList il = userControlMedia1.ImageListMedia;

Hope this helps

Tom
 
Back
Top