jppinto
asked on
Excel Ribbon Add-in - Combobox dynamically add items
Hello,
I've a ribbon add-in for Excel where I have some buttons and some comboboxes. I know how to add items to the combobox in Visual Studio but I would like to load the items dynamically on startup reading the values from a textbox.
At the momment I have the following code but I need help on the part where I add the items to the cboDepartamentos combobox.
Can you please help me?
Thanks,
jppinto
I've a ribbon add-in for Excel where I have some buttons and some comboboxes. I know how to add items to the combobox in Visual Studio but I would like to load the items dynamically on startup reading the values from a textbox.
At the momment I have the following code but I need help on the part where I add the items to the cboDepartamentos combobox.
Can you please help me?
Thanks,
jppinto
Private Sub Ribbon1_Load(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonUIEventArgs) Handles Me.Load
Dim fileName As String = "D:\TextFiles\Departamentos.txt"
Dim lines() As String = IO.File.ReadAllLines(fileName)
For Each line As String In lines
'cboDepartamentos.Items.Add... here's where I need help!
Next
End Sub
ASKER
No, it's not available.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm working with the 2008 version of VS.
that should be fine too
ASKER
Thanks. Worked like a charm.
You said that the syntax
cboDepartamentos.Items.Add
is not available!
cboDepartamentos.Items.Add
is not available!
ASKER
I've tryed like this:
cboDepartamentos.Items.Add ("Test") and it wasn't available but like this:
cboDepartamentos.Items.Add ( _
New Microsoft.Office.Tools.Rib bon.Ribbon DropDownIt em _
With {.Label = line})
was OK.
cboDepartamentos.Items.Add
cboDepartamentos.Items.Add
New Microsoft.Office.Tools.Rib
With {.Label = line})
was OK.
cboDepartamentos.Items.Add