I have an MDI container with a ToolStrip. I ran into a naming issue with images/icons. I removed the lines of code referring to the image of the buttons in the MDIForm.Designer.VB file. Then, in the actual designer, I imported the image file as a project resource and added this image to each button.
When I view the MDI form in the designer, the buttons appear normally, but when I run the app, the buttons are not there!
Should i have not edited the designer.vb file directly? Can this be fixed without recreating each button?
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Before getting into the re-creating of it, exit VS then delete the bin and obj folders from inside that project, then start VS and open the project and run it to see if the toolstrip displays normally.
If the buttons show at design time but not at run time it's possibly not compiling correctly (so you don't see the same thing at run time as you do at design time).
Currently using VS 2015 Enterprise on Win10 Enterprise x64.
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Before getting into the re-creating of it, exit VS then delete the bin and obj folders from inside that project, then start VS and open the project and run it to see if the toolstrip displays normally.
If the buttons show at design time but not at run time it's possibly not compiling correctly (so you don't see the same thing at run time as you do at design time).
I was going to suggest the same thing. If the buttons are still there in the designer then their code cannot be lost (where would the designer be getting them from?), unless you haven't "reloaded" the designer yet. You can do that by simply closing the form design file (in visual studio) and re-opening it. If the buttons are still there, you haven't lost anything, but something is going wrong during compilation, or they are even made invisible or something (I've no idea how that could happen though).
Can you post the designer code, so we can have a look?
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
I was going to suggest the same thing. If the buttons are still there in the designer then their code cannot be lost (where would the designer be getting them from?), unless you haven't "reloaded" the designer yet. You can do that by simply closing the form design file (in visual studio) and re-opening it. If the buttons are still there, you haven't lost anything, but something is going wrong during compilation, or they are even made invisible or something (I've no idea how that could happen though).
Can you post the designer code, so we can have a look?
Ah-ha! I closed the actual designer and re-opened it... the buttons are gone.
The designer file now has this code for the image of each button... weird...
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
ok, scratch the last part about the image code. that was only that button. As you'll see in the designer code, the images are called from my resources.
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Ok, that means the buttons are really no longer in the toolstrip. However, it does not mean they are gone.
Judging from your designer code (of course I can't be sure), all that has happened is that the buttons are no longer added to the toolstrip.
If you look at the
Code:
'
'ToolStrip
'
section, everything below that is probably a button on that toolstrip (right? or not?). If that is the case, all you need to do is add the code that adds those buttons.
You may be able to add something like this
After you've added each button this way, reload the designer and see what happens.
Quite a lot of work if there's lots of buttons, but perhaps it will work.
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'
Quote of the day from jmcilhinney:
'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'