How to make toolbar drop-down menu?

In VS2003, a toolbar button can have a drop-down menu by assigning a contentMenu to its DropdownMenu property.  However, I fail to do this in VS2005 beta 2 in which I cannot select my ContextMenuStrip(replacing old ContextMenu) as the DropDownMenu property.
How should I produce drop-down menu for toolbarbutton in VS2005


Answer this question

How to make toolbar drop-down menu?

  • BioGeek

    Public Sub LoadToolbarList(Optional ByVal bMenuExtensions As Boolean = False)

    Dim count As Byte

    Const cExtentionLength As Byte = 3

    Dim Separator1 As New System.Windows.Forms.ToolStripSeparator

    Dim sFullFilePath As String = My.Computer.FileSystem.GetParentPath(Application.ExecutablePath) & "\"

    Dim sFound As String

    DropDownButton.DropDownItems.Clear()

    DropDownButton.DropDownItems.Add(DropDownMenuConstants.cToolbarSelection)

    DropDownButton.DropDownItems.Add(Separator1)

    count = DropDownButton.DropDownItems.Count - 1

    DropDownButton.DropDownItems(count).Text = DropDownMenuConstants.cIgnore

    For Each foundFile As String In My.Computer.FileSystem.GetFiles _

    (sFullFilePath, True, "*.dbs")

    sFound = My.Computer.FileSystem.GetName(foundFile.ToString)

    'Make sure we only load extensions which are three characters long

    If cExtentionLength <> (sFound.Length - sFound.LastIndexOf(".") - 1) Then GoTo Next_Iter

    sFound = sFound.Remove(sFound.Length - cDatabaseExtension.Length, cDatabaseExtension.Length)

    If sFound.Length = 0 Then

    Kill(Application.StartupPath & "\" & ".dbs")

    GoTo Next_Iter

    End If

    If sFound <> Settings.Settings.sToolbar And (Not IsOnExclusionList(sFound)) Then

    AddToolbarNameToDropDown(" " & Capitalize(sFound))

    End If

    Next_Iter:

    Next

    If bMenuExtensions Then

    Dim Separator2 As New System.Windows.Forms.ToolStripSeparator

    Dim Separator3 As New System.Windows.Forms.ToolStripSeparator

    Dim Separator4 As New System.Windows.Forms.ToolStripSeparator

    count = DropDownButton.DropDownItems.Count - 1

    DropDownButton.DropDownItems.Add(Separator2)

    count += 1

    DropDownButton.DropDownItems(count).Text = DropDownMenuConstants.cIgnore

    DropDownButton.DropDownItems.Add(DropDownMenuConstants.cCustomize)

    count += 1

    DropDownButton.DropDownItems.Add(Separator3)

    count += 1

    DropDownButton.DropDownItems.Add(DropDownMenuConstants.cHelp)

    count += 1

    DropDownButton.DropDownItems.Add(Separator4)

    count += 1

    DropDownButton.DropDownItems(count).Text = DropDownMenuConstants.cIgnore

    count += 1

    DropDownButton.DropDownItems.Add(DropDownMenuConstants.cExit)

    End If

    End Sub



  • How to make toolbar drop-down menu?