Inherited controls not inheriting control after rebuild

I have an imagelist on a parent user control. I put 5 images in the image list and then created a child user control that inherits from the parent user control. The imagelist and all 5 images were inherited in the child user control.


At some later point, I put some more images in the base class imagelist and rebuilt the project. I am expecting to see the new images in all child controls. The child controls still only show the original 5 images.

Does anyone know how I can force a refresh for all inherited controls?

Thanks!
LVL 8
gregasmAsked:
Who is Participating?
 
GranModConnect With a Mentor Commented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0
 
Bob LearnedCommented:
Now that sounds like a bug.  Inheriting controls is just plain freaky in .NET.  What .NET version are you using?  2005?

Image resources are stored in the .resx files.  Maybe renaming them will force the compiler to recreate for the inheriting forms.

Bob
0
 
gregasmAuthor Commented:
Hi Bob,

I was able to get the inherited image lists to refresh once by cutting the base imagelist and then immediately pasting it back in. All inherited were refreshed.

I can't get it to work again like that.

I went to a child control, and deleted the resx file, made a slight change to the child control, and recompiled. The new resx was created, but the inherited imagelist still does not have all the images.

HMM... DOH. I do not want to break up my little inheritance hierarchy with workarounds unless I absolutely have to... Someone else must have seen this before...
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
gregasmAuthor Commented:
This was for VS2003... I hope I am like many other developers who are still waiting for the right time to switch to 2005. I am in the middle of a major project still using 2003 and switching to 2005 before stabilizing and deploying it seems like a big mistake.

OK, well, anyway, here is the workaround.

In the base class, I copied the original image list to the same form, and it got assigned a new name. I recompiled, making sure the new imagelist was available to all the inheriting forms. It was.

Then I deleted the original imagelist from the base class, and renamed the new one to the name of hte old one and recompiled again.

All the child forms now have the updated imagelist.

Please close.
0
 
anyoneisCommented:
Since you answered it yourself, what is the answer? I have run into this with VS2005, and the way I get around it is to open the child control in a designer window, and then rebuild the solution.

David
0
 
gregasmAuthor Commented:
anyoneis, just read the thread... you will find the workaround in a previous post.
0
 
anyoneisCommented:
Oh, *that* workaround. I was hoping you came up with something that was less work! My guess is that this problem will not be rectified when you move to 2005.

David
0
 
gregasmAuthor Commented:
lol :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.