View Full Version : About Menu Item
TelephoneGal
12-14-03, 05:52 PM
Hello All,
I am new to Visual Basic,and I'm learning thru books and I can't seem to figure out how to make a menu item appear.
I want to make an "About" menu item and when the user clicks on it,it will show my predefined about this website string.
I can't quite understand the MsgBox function.
If anyone has any ideas they would be greatly appericated.
Thanks,
ewchin81
07-31-07, 06:20 AM
Just open a standard exe, then choose a command button then type in below code, a message box will appear.
Private Sub Command1_Click()
MsgBox " hello world"
End Sub
ewchin81
07-31-07, 06:22 AM
Just open a standard exe, then choose a command button then type in below code, a message box will appear.
Private Sub Command1_Click()
MsgBox " hello world"
End Sub
Keithuk
08-27-07, 06:02 PM
Open up your VB project. Show the Form you want to make a menu for, double-click on the Form name in the Project Explorer window.
Select Tools\Menu Editor... Ctrl+E from the VB menubar. If the Menu Editor is greyed out then you aren't viewing the Form. Then you just start writing you menu items.
The Caption is the text you see in that menu item.
The Name is the name you give that item.
The Index is used if you are using a menu array.
The Checked is used when you want to show and item is being used.
The Enabled speaks for itself, you can use it.
The Visible speaks for itself, you can see it.
The WindowList is used in MDI Forms to show the different Forms you have open.
There is also a ComboBox with a list of Short-cut keys you can set for a menu item, but you can only use one on each item.
At top item in a menu will always be shown in the far left of the menu listbox.
Lets say you want this About menu under the Help menu. So you would first make a Help menu.
Caption - &Help
Name - mnuHelp
You can use the & character in the Caption to display the Hot Key for that menu item. Because the Help Caption is &Help that means that if you press Alt+H the Help menu will extend. Now this feature was great on Win9x/ME but on Win2k/XP you can't see any underlined menu captions until you press the Alt key.
Anyway back to this menu. Now you have Help in there you need to add your About. If you click on the line below Help in the menu list it will clear the Caption and Name. Just type &About... in the Caption and mnuAbout in the Name.
Now because About is a sub menu item you need to step this once to the right. Highlight the About and click the little right facing arrow button. This will step the menu item one place to the right. The up and down arrows move that item up and down in the menus. then just click the OK button. Now you have your menu item you need to write the code that will go in that menu. ;)
A final note: All controls used in VB should have a prefix. As you are new to VB this is something that you will have to get used to. From the above example I gave the menu item Name mnuHelp. You use 3 lowercase characters to describe that control.
This is the same for all other controls used. It makes you code a lot easier to follow. If you had Command1 you would have to like what does Command1 do. If you gave it a name cmdOpen then you have a better understanding it must open something. A list of all these prefixes are in the VB6 help. If you open the VB6 help and type in prefixes in the word to find you are nearly there, its the next item down, for control names. ;)
I can't quite understand the MsgBox function.
While you have the VB6 help open just type in MsgBox function the help is there.
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.