Results 1 to 13 of 13

Thread: [RESOLVED] ToolStrip Buttons are gone!

  1. #1

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Resolved [RESOLVED] ToolStrip Buttons are gone!

    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?
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: ToolStrip Buttons are gone!

    Should i have not edited the designer.vb file directly?
    That's correct. There's even a warning in the comments section located near the top.

    Can this be fixed without recreating each button?
    Maybe... but it's best just to recreate them. You'll not want to mess with the designer files directly anymore. Especially after what just happened.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    Would it be best to completely recreate the ToolStrip as well?

    There's nothing like learning something the hard way... especially knowing, with a little bit of reading, I wouldn't have had to.

    Thanks for the bad news and for planning my evening out for me. lol ;-)

    All kidding aside, thanks, as always for the info.
    Last edited by jazFunk; Apr 5th, 2010 at 12:36 PM. Reason: typo
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  4. #4
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: ToolStrip Buttons are gone!

    Would it be best to completely recreate the ToolStrip as well?
    I would. Just in case
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: ToolStrip Buttons are gone!

    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.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  6. #6

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    Are you a Spartan fan? Heartbreaking weekend.

    So, those folders will automatically be re-created?
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  7. #7
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: ToolStrip Buttons are gone!

    Quote Originally Posted by JuggaloBrotha View Post
    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?

  8. #8

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    This is my 200th post and it is the only reason I'm posting this message. Tip one back to celebrate.
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  9. #9

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    Quote Originally Posted by NickThissen View Post
    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...

    vb Code:
    1. Me.SaveToolStripMenuItem.Image = CType(resources.GetObject("SaveToolStripMenuItem.Image"), System.Drawing.Image)

    I've attached the designer.vb file
    Attached Files Attached Files
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  10. #10

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    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.
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  11. #11
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: ToolStrip Buttons are gone!

    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
    Code:
    Me.ToolStrip.Items.AddRange(New ToolStripItem() {tsbHome, ToolStripSeparator29, JobsToolStripDropDownButton, ... etc})
    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.

  12. #12

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: ToolStrip Buttons are gone!

    That worked!!!

    I checked out a back-up from last week of the designer.vb file and copied/pasted this line of code and it worked. Thank you so much!


    vb Code:
    1. Me.ToolStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.JobsToolStripDropDownButton, Me.ToolStripSeparator11, Me.TakeOffToolStripSplitButton, Me.ToolStripSeparator23, Me.tsbATMNewSite, Me.ToolStripSeparator14, Me.SignCodesToolStripButton, Me.ToolStripSeparator9, Me.Shippe*******tripDropDownButton, Me.ToolStripSeparator16, Me.LockToolStripSplitButton, Me.NewToolStripButton, Me.OpenToolStripButton, Me.SaveToolStripButton, Me.ToolStripSeparator1, Me.PrintToolStripButton, Me.PrintPreviewToolStripButton, Me.ToolStripSeparator2, Me.HelpToolStripButton})
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

  13. #13

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: [RESOLVED] ToolStrip Buttons are gone!

    ...and yes, the code below the

    vb Code:
    1. '
    2. ' ToolStrip
    3. '
    were all buttons on this ToolStrip.
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    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.'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width