Problem with ImageLists and inheritance

DWooldridge

New member
Joined
Nov 30, 2006
Messages
2
Programming Experience
3-5
All right, here's the situation:

I have two forms, Form1 and Form2. Form2 inherits from Form1. Form1 contains an ImageList, with a couple of images. Form 2 has a toolbar, whose ImageList property is set to Form1's ImageList.

So far, so good. Here's the problem: if I add an image to Form1's ImageList, that new image does not show up in the designer for Form2. I've tried rebuilding, reloading Visual Studio, etc; nothing seems to help.

Any advice on this matter would be greatly appreciated. :)
 
Did you set the ImageList's Modified to Protected Friend?
Yep. The initial inheritance works fine; it's just that whenever I try to modify Form1's ImageList, the changes don't carry through to Form2.

One more thing: I've just created a third form, Form3, in the same project, that also inherits from Form1, but does not use Form1's ImageList. As it turns out, any changes made to Form1's ImageList do carry though to Form3, but not to Form2. From this, I conclude that the problem manifests itself if and only if the inheriting form is using, or has used, the base form's ImageList.
 
Ok, I manage to simulate your problems and hope I get it right. I think previously you had made a changes to the Form2's inherited ImageList, and cause whatever you change to the Form1 won't reflect to Form2's ImageList's images array. This problem also cannot be solved by resetting the Images in the Form2.

I only can solve it by
1) Go to the form's code view
2) Expand the "Windows Form Designer generated code" region
3) Find the ImageList
4) Delete the code.
5) Rebuild and your Fomr2 will get back to synchronize to Form1!
 
Back
Top