ImageList on windows form UserControl

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??
 
T

Tom John

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top