Toolbar button with the DropDown style, how to use it? Can anyone give a sample of that?
The so named ‘Help’ do not provide any information how to use it.
Printable View
Toolbar button with the DropDown style, how to use it? Can anyone give a sample of that?
The so named ‘Help’ do not provide any information how to use it.
There are two ways to do that:
1. Design Time: After adding Toolbar to your form and adding Buttons to it, add a ContextMenu to your form and add appropriate Menu items to it by clicking the ContextMenu and typing menu text. Then in your Toolbar Buttons property page select the button you want to be a dropdown button and change it's Style property to DropDownButton and change it's DropDownMenu property to the ContextMenu that you've just created.
2: Run Time:
'Add this to the top of your form
Imports System.Windows.Forms
'Add this to some procedure
Dim myContextMenu As New ContextMenu()
Dim myFirstItem As New MenuItem("First")
Dim mySecondItem As New MenuItem("Second")
myContextMenu.MenuItems.AddRange(New MenuItem() {myFirstItem, mySecondItem})
'Use your DropDownButton index instead of 0
With Me.myToolbar.Buttons(0)
.Style = ToolBarButtonStyle.DropDownButton
.DropDownMenu = myContextMenu
End With
Good luck, Bona
Thanks, Vahid.