How to put a menu bar in an application

3k Views Asked by At

I'm having some problems with eVB. How can I put a menu bar in an eVB project? I can't see any components to do that, and I don't know how to do this. Here is an example of a menu bar made in eVB, but it's not my program. I found this image in Google:

This is a example of menu bar! http://msdn.microsoft.com/en-us/library/ms838303.aspx


Thanks, but i've resd this article of MSDN: http://msdn.microsoft.com/en-us/library/ms838303.aspx, but i've see that this component is from the Odyssey Inc., but when i try to acess the site i can't find this component for download.

3

There are 3 best solutions below

0
On BEST ANSWER

I've asked the same question in the DevBUZZ foruns, and i solved my problem, here is the link for more details: http://forums.devbuzz.com/How_To_Put_a_Menu_Bar_in_an_Aplication/m_41726/tm.htm

And here is the code to do this using a CommandBar:

Option Explicit

Private Sub Form_Load()
    InitCommandBar
End Sub

Sub InitCommandBar()
  Dim mnuMain As CommandbarLib.CommandBarMenuBar
  Dim mnuFile As CommandbarLib.Item
  Dim mnuEdit As CommandbarLib.Item

  Set mnuMain = CommandBar1.Controls.Add(cbrMenuBar, "MainMenu")
  'add File menu items
  Set mnuFile = mnuMain.Items.Add(1, "File", "File")
  mnuFile.SubItems.Add , "Open", "Open"
  mnuFile.SubItems.Add , "Add", "Add"
  mnuFile.SubItems.Add , "Update", "Update"
  mnuFile.SubItems.Add , "Delete", "Delete"

  'add Edit menu items
  Set mnuEdit = mnuMain.Items.Add(2, "Edit", "Edit")
                mnuEdit.SubItems.Add , "Sort", "Sort"
                mnuEdit.SubItems.Add , "Find", "Find"
End Sub
0
On
2
On

I finally found and re-installed eVB. Here is the code to add menus taken stright from the help file. I tested it first. It works. First, add a CommandBar. The CommandBar and MenuBar have been combined into this tool.

Private Sub Form_Load()
    InitCommandBar
End Sub

Sub InitCommandBar()
  Dim mnuMain As CommandbarLib.CommandBarMenuBar
  Dim mnuFile As CommandbarLib.Item
  Dim mnuEdit As CommandbarLib.Item

  Set mnuMain = CommandBar1.Controls.Add(cbrMenuBar, "MainMenu")
  'add File menu items
  Set mnuFile = mnuMain.Items.Add(1, "File", "File")
  mnuFile.SubItems.Add , "Open", "Open"
  mnuFile.SubItems.Add , "Add", "Add"
  mnuFile.SubItems.Add , "Update", "Update"
  mnuFile.SubItems.Add , "Delete", "Delete"

  'add Edit menu items
  Set mnuEdit = mnuMain.Items.Add(2, "Edit", "Edit")
                mnuEdit.SubItems.Add , "Sort", "Sort"
                mnuEdit.SubItems.Add , "Find", "Find"

BTW - I did not find a menu editor.