Add items to Backstage Combo Box at Runtime

Add-in Express™ Support Service
That's what is more important than anything else

Add items to Backstage Combo Box at Runtime
 
Mark Proctor




Posts: 6
Joined: 2019-07-20
When adding items at run-time only 1 item is showing in the combobox but the items are being added. Code below:

If ContactList.Count > 0 Then
Dim NewItem As New ADXBackstageItem
Dim iCounter As Integer = 0
AdxBackstageComboBox1.Items.BeginUpdate()

For iCounter = 1 To ContactList.Count
NewItem.Id = iCounter - 1
NewItem.Caption = ContactList.Item(iCounter - 1).Email1Address

AdxBackstageComboBox1.Items.Add(NewItem)
Next
AdxBackstageComboBox1.Items.EndUpdate()
AdxBackstageComboBox1.Invalidate()
End If

What am i doing wrong?
Posted 20 Jul, 2019 05:20:04 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Mark,

Try this one:

       If ContactList.Count > 0 Then
            Dim NewItem As ADXBackstageItem
            Dim iCounter As Integer = 0
            AdxBackstageComboBox1.Items.BeginUpdate()

            For iCounter = 1 To ContactList.Count
                NewItem = New ADXBackstageItem(Me.components)
                NewItem.Id = "someLetters" + iCounter - 1
                NewItem.Caption = ContactList.Item(iCounter - 1).Email1Address

                AdxBackstageComboBox1.Items.Add(NewItem)
            Next
            AdxBackstageComboBox1.Items.EndUpdate()
            AdxBackstageComboBox1.Invalidate()
        End If


Also make sure all the Ribbon controls in your add-in have unique IDs.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jul, 2019 03:03:56 Top