You can kill the background for speed, if you wish.[x]

Thursday, October 25, 2007

Of MainMenus, MenuStrips, and Visual Basic 2005

So today in class, we were doing a simple introduction to menus. My book said to add a MainMenu control to my form, which I had to conjure up from right-clicking on the toolbox and finding it in "Choose Items". The MainMenu control is distinctly different from the MenuStrip control - the MenuStrip is all new and has the fancy blue strip down the side, the MainMenu is decidedly more compact and old-fashioned (think Office 2000 vs Office 2003/XP). And my book said to use MainMenu. So I did, and I created my menu, and it was beautiful. And then I went to run it, and my menu disappeared. And no matter where I looked, or how hard I tried, I couldn't get my MainMenu to attach itself to my form. A MenuStrip showed up just fine, but the MainMenu refused to work. I tried adding new MainMenus and they didn't work. And I wanted to fix it. So I asked my neighbor, and it turns out his book (same edition, same ISBN) told him to use MenuStrip. Well isn't that just peachy. He tried his best, but to no avail. Finally, out of desperation, I right-clicked on the menu in the little tray below the form, selected "Cut", and then pasted it back in. And it worked.
Augh!
So stupid...so I just had to go through the event procedures I had written and re-add the "Handles mnuFileExit.Click" type thing to each procedure, and it worked like a charm.
So in summary, if you're ever using the MainMenu control in Visual Studio 2005, and it won't attach to the form, or disappears when you click elsewhere, just cut, paste, and re-add your Handles clauses to your event handlers.
I will be glad when I can get out of this insanity and go back to my nice, warm, comfortable Linux. How did I survive in this cold, hard, angry world of Windows for so long is beyond me.

No comments: