Link to home
Start Free TrialLog in
Avatar of gregasm
gregasm

asked on

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!
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

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
Avatar of gregasm
gregasm

ASKER

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...
Avatar of gregasm

ASKER

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.
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
Avatar of gregasm

ASKER

anyoneis, just read the thread... you will find the workaround in a previous post.
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
Avatar of gregasm

ASKER

lol :)
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial