Create Menu in VB.Net (MS 2005 Edition)

mkranz

New member
Joined
Dec 16, 2004
Messages
1
Programming Experience
10+
Hi, I just want to migrate an existing VB5 Project to VB.Net. I'm using the Microsoft Visual Basic Express Edition 2005 (beta) which transfered my code in .NET syntax. That has worked - but the application has lost my menu. My question now is how to transfer the following code :

Begin VB.Menu MenuFile
Caption = "File"
Begin VB.Menu MenuOpen
Caption = "Open"
End
Begin VB.Menu MenuSaveAs
Caption = "Save as"
End
Begin VB.Menu MenuExit
Caption = "Exit"
End
End
Begin VB.Menu MenuReturn
Caption = "Return"
End
Begin VB.Menu MenuRefresh
Caption = "Refresh"
End
Begin VB.Menu MenuAuto
Caption = "Auto mode"
End

..so that this works:

Form1.MenuReturn.Visible = False

Private Sub MenuOpen_Click()

Dim dlgCommonDialog As Object
Dim FileAfter As Object
Dim FileBefore As Object
Dim lenlin As Integer
...

Sounds very easy, but I counld't find any advice.

Hope someone can help me.

Thanks a lot
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
in the form designer: add a mainmenu item to the form (the actual object will be in the component tray @ the bottom) but just under the title bar (where the menu normally is) is where you can start type in the Text field (there is no caption) for the menu items, when you select a menu item the properties appear in the Properties Windoe @ the left.

 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
You could also use a MenuStrip which is very simular to the MainMenu control with a little extra functionality like theme support (gradients like the Office 2003 menus). You can also add MenuStrips to panels where you can't add the MainMenu control.
 
Top Bottom