Re: Adding Menus In vb

Marv, here is a general write up and a specific step by step example of a Menu Strip I created for this message to you. I don't know about fancy buttons but what I generally do is just drop a MenuStrip on a page. Then add the top level tabs like File, Edit, View, help and anything else I want like Sort, Database, or whatever. Once I have dropped my top level tabs on the form I right click on one of them and arrow down the Context Menu to the choice that says something like Edit PullDown Items or something close to that. That puts me into a Properties window for that tab. I then tab around to the drop down box that has a few choices of the type of item to add to the top level tab. One of them is called something like MenuItem and I select that then tab to the Add Button and hit enter. Then I tab to the Properties for that control, I think it is like a button, and change the name to something that makes sense to me. Then I arrow down to the Text property and change it to display something that will tell me what the button will do when clicked. Then I tab to ok and click enter. This returns me to the Forms Designer. I then right mouse click the new button under the root tab and the real properties window comes up. I verify that the control is correct and then tab to the ToolStrip and arrow to the Events Tab. Then I click it and I am put into the Editor window where I can edit code for that control when clicked on. I usually just put a MessageBox.show( "This Item Clicked") in the event code for that pull down item and then close it out, close the Forms Designer and then test the pform to make sure the menu bar comes up with my list of root options. I do the pull down for the item I created and click it and the MessageBox pops up telling me that pull down is wired up. You can use the properties for the controls to make them look however you want and even have other things a sighted person might like without too much other than just setting properties.So I might:
Create a form like frmTestForm:
bring up the form before I add anything to it. I set the size to 100, 700 and background color to black and foreground color to white and font size to about 12 and StartPosition to center. Then I do Menu>View>ToolBox, arrow to MenuStrip under the Menus andToolBars tab and hit enter and a Menu Strip is dropped on my form.
I right mouse click it and a context menu pops up:
I arrow down to the EditItems option and hit enter and the Items Collection Editor Window comes up.
I tab to the DropDown box that says Select an Item  and Add To List:
I have a choice of a MenuItem, ComboBox or TextBox. I highlight the Menu Item and tab to the Add Button and hit enter. A new item called ToolStripMenuItem1 is added to the root tabs of my MenuStrip. I tab to the properties for this item and change the name to DatabaseActions and the Text Property to Database Actions. I tab to ok and hit enter and I am returned to the Forms Designer with a new ToolStrip and one root level tab that says Database Actions. I will put all my database PullDown Buttons actually called MenuItems, under this tab. For this example I will now put 2 buttons, MenuItems I can click on. The first will be a button that will drop a table in the database and the second a button to create that table.
So I fire up the Forms Designer:
Tab to the MenuStrip:
Route the mouse to the top level item labeled Database Actions and right mouse click it:
Another context menu pops up:
I arrow down to  EditDropdownItems and hit enter:
TheItems Collection Editor comes up:
I tab to the pull down that says select an item and add to list below,I have a choice of MenuItem, ComboBox,Seperator or TextBox. I highlight the MenuItem and tab to the add button and hit enter: I tab to the Properties table and change the name to DropTable and text to Drop Table:
I tab to ok and hit enter and am returned to the Forms Designer.
I then Right mouse click the new item to bring up the real Properties Window for the new pulldown button control: I verify I have the right control in the properties window, tab to the ToolBar and right arrow to the Events Button and hit enter. I then arrow to the click event and hit enter:
I am put into the Code editor and I enter:
MessageBox.Show( "Drop Table Control Was Clicked")
and exit the code editor.
I then also exit the Forms Designer:
I set my startup form to the new frmTestForm so I can work with it.
Then I do a control and f5 to run the project and the new frmTestForm comes up with a Menu Bar across the top of the form: I hit the Alt key to open it for Windoweyes and it says :Database Actions since that is the first, and only so far, root tab in the Menu Strip. I then arrow down and hear the Drop Table item, I hit enter and the pop up MessageBox says Drop Table Was Clicked, I hit OK and I am in the frmTestForm again and can do that as many times as I want. I do alt and f4 to exit the test and return to editing my project. Now, you can continue adding root items to the MenuStrip as detailed above by bringing up the Forms Designer and then right clicking on the MenuStrip iteslf. You can add pull down items to any Root level tab items by right mouse clicking on the Root Item and doing as we did above. You can set many properties for all the items to make them look and act in many diferent ways. I hope this get you an understanding of the process. I just did this while writting this to you and it works great. Let me know if you have any problems but I use the MenuStrip all the time, it is clean and fast for clients and I like keeping my main work area of a form clean.
Rick USA

__________
View the list's information and change your settings at http://www.freelists.org/list/programmingblind

Other related posts: