Thursday, October 23, 2008

Friday October 24: fun with menus

Greetings, and yes, it's good to be back. Today we will work towards accomplishing two goals:

A) using menus in your VB applications

B) working on your projects

and btw, you need to pass in both these items today before the class is done!

Anyway, lets get going with menus. The first step is to start a new VB project, and name it after yourself plus the word "menus".

Next, scroll down in the list of controls at the left and drag a "MenuStrip" onto your form. It doesn't matter where, since its just a container, and the real guts of it will always go up at the top of the form

Next, go up top to where those "guts" are; it will say "TYPE HERE" click there, and type the word "FILE" then hit the Enter key

Repeat this process four more times, adding the following menu items:
NEW
OPEN
SAVE
EXIT

Save your work, then run the program to make sure your new menu looks OK. You should be able to click on all of the menu items, but they won't do anything....yet!

OK, now to make one of your menu items actually do something. Doubleclick on the "EXIT" menuitem to get into it's code, then type in this code:

Me.Close( )

Save, then run the program. See if the EXIT command now brings you out of the program.

Does it work? Cool! OK, let's do one last thing: Add a textbox to your form, re-size it so that it takes up most of the form. In the Properties sheet at the right, rename the textbox to "MyWords" and set its "Multi-line" value to TRUE. When you're ready, I have some very interesting code for you

Cheers,
Mr. L

No comments: