Unable To clear ListBox

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

Unable To clear ListBox
 
Davide Crudo




Posts: 23
Joined: 2005-05-09
I have put a commandbar Object in my project and added two components under it (A button and a Listbox).

The issues I have are the following:

1) How can I clear the Listbox when Opening Excel?
(it contains old data) I've tried with OnAddInInitialize but the
following command doesn't work:

adxCB.Controls[1].AsDropdownList.items.clear;

2) After pushing a button that will populate the Lisbox, I cannot
visualize the first item automatically with the command:

adxCB.Controls[1].AsDropdownList.itemindex := 0;

...and I would like to show some caption, like [Choose your Item] from
the list.

Thank you in advance for pointing me where to find more infos on this subject!

Dave
Posted 13 Jun, 2005 10:08:46 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Davide,

1) Try to use the OnAddInStartupComplete event instead of OnAddInInitialize. In the OnAddInStartupComplete event all controls are already connected. Also use the code below:
adxCB.Controls[1].AsDropdownList.Clear;

2) adxCB.Controls[1].AsDropdownList.ListIndex := 1;

As for caption: set the Style property to the adxMsoComboLabel and set the Caption property.

Posted 13 Jun, 2005 10:24:21 Top
Davide Crudo




Posts: 23
Joined: 2005-05-09
Hello,

Adding the following line to the procedure "TAddInModule.adxCBControls0Click(Sender: TObject);"

adxCB.Controls[1].AsDropdownList.itemindex := 0;

Generates the following Error:
A_Retrieve error: the add-in has fired an exception.
Invalid index

Only after registering the Plug-in. Reopening excel doesn't do the same...but the result is that the toolbar cannot be docked.


Posted 14 Jun, 2005 03:55:16 Top
Dmitry Kostochko


Add-in Express team


Posts: 2742
Joined: 2004-04-05
Hi Davide,

Try the code below:
adxCB.Controls[1].AsDropdownList.ListIndex := 1;

Posted 14 Jun, 2005 04:25:15 Top