grip003 Posted September 14, 2004 Posted September 14, 2004 This post is an add-on to the jccorner post "Icons not appearing in toolbar" made on 4-23-2004. More specifically, it is a question about the solution posted by JABE: I've read this sort of problem in another forum. The culprit was discovered in InitializeComponent where the toolbarIconImageList was assigned to toolbar.ImageList prior to being initialized. What the poster did was swap the lines of code so that the toolbarIconImageList was instantiated first prior to assignment to the toolbar.ImageList property. Hope this fix works for you as well. I, too, have had this problem, and the above fix works, at first. But, after making a few changes to my code, the IDE re-writes the InitializeComponent method, and therefore the swap I made in that code is changed back. Is there any way to force certain code to remain where it is in the InitializeComponent method? Right now I have to go and swap the code every time I want to see my icons, which is terribly frustrating. Quote
grip003 Posted September 15, 2004 Author Posted September 15, 2004 It seems that after I have saved my project with the correct swap and exited .net, my problems have been fixed. It has not reverted back to the wrong ordered code all today, so hopefully the problem has just gone away. I will reply to this post or post a new thread if the problem comes back. Thank you to anyone who tried to solve this problem, I really do appreciate it. Quote
grip003 Posted September 15, 2004 Author Posted September 15, 2004 Sorry about this, but the same thing has happened again. I don't know what causes the InitializeComponent() method to be re-written by the IDE. Anyway, the first message of this thread is still the main question. Please help. Quote
*Experts* Bucky Posted September 15, 2004 *Experts* Posted September 15, 2004 Perhaps if you placed the two swapped lines of codes inside a separate subroutine, you could then call this method from InitiailizeComponent() without the IDE replacing it. Actually, you might only need to include the second line of the two; just make sure it comes at the end... Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
grip003 Posted September 16, 2004 Author Posted September 16, 2004 Thanks, Bucky, for your help. However, after a bit of frustration with the toolbar, I completely removed it from my project and built a panel that works basically the same. Also, I get to set the focus to all the buttons I put in a panel, unlike with a tool bar. Another plus is that I no longer have the problem with the imagelist anymore. I don't know if it is because I added the buttons after the image list, or what. Anyway, I've given up on the toolbar for now. It just seems that a panel can be more flexible than a toolbar anyway. Thanks again to everyone who has been looking at this one. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.