Add item to a listbox in a ribbon

  • Thread starter Thread starter ino_mart
  • Start date Start date
I

ino_mart

Guest
All

I have code below in a VSTO-project (a customized toolbar in Outlook). CreateListbox will create a listbox in the given ribbongroup with a name, label and the first entry in the listbox.

AddListBox is supposed to add extra items into a given listbox. However, I do not manage to get this working as "Add" is not a member of "RibbonControl".


Private Sub CreateListbox(ByRef grp As RibbonGroup, strName As String, strLabel As String, strFirstItem As String)
Dim rb = Me.Factory.CreateRibbonDropDown
rb.Name = strName
rb.Label = strLabel

Dim item As RibbonDropDownItem
item = Me.Factory.CreateRibbonDropDownItem()
item.Label = strFirstItem
rb.Items.Add(item)

AddHandler rb.SelectionChanged, AddressOf RbWebsite_SelectionChanged
grp.Items.Add(rb)
End Sub



Private Sub AddListItem(ByRef grp As RibbonGroup, ByRef lst As RibbonDropDown, strItem As String, myTab As RibbonTab)
Dim item As RibbonDropDownItem

item = Me.Factory.CreateRibbonDropDownItem()

For intX As Integer = 0 To myTab.Groups.Count - 1
For intY As Integer = 0 To myTab.Groups(intX).Items.Count - 1
If myTab.Groups(intX).Items(intY).Name = lst.Name Then
myTab.Groups(intX).Items(intY).Add(item)
Exit Sub
End If
Next
Exit For
Next

End Sub

Continue reading...
 
Back
Top