Kevin Curry
Posts: 9
Joined: 2007-01-03
|
Hello,
I am having quite a bit of trouble with the AdxCommandBarDropDownList. It throws an exception whenever I tried to add something to it. Here's snippets of test code:
In InitializeComponent (your code, actually):
this.MyDropDown = new AddinExpress.MSO.ADXCommandBarDropDownList(this.components);
Then inside a method:
for (int i = 0; i < 3; ++i)
{
MyDropDown.Items.Add("test" + System.Convert.ToString(i));
}
Sometimes it works. 95% of the time I get this:
- MyDropDown { [AddinExpress.MSO.ADXCommandBarDropDownList]} AddinExpress.MSO.ADXCommandBarDropDownList
+ base { [AddinExpress.MSO.ADXCommandBarDropDownList]} AddinExpress.MSO.ADXCustomCommandBarComboBox {AddinExpress.MSO.ADXCommandBarDropDownList}
+ DropDownLines 'MyDropDown.DropDownLines' threw an exception of type 'System.Runtime.InteropServices.COMException' int {System.Runtime.InteropServices.COMException}
+ DropDownWidth 'MyDropDown.DropDownWidth' threw an exception of type 'System.Runtime.InteropServices.COMException' int {System.Runtime.InteropServices.COMException}
+ Items {AddinExpress.MSO.ADXStringCollection} AddinExpress.MSO.ADXStringCollection
+ ListCount 'MyDropDown.ListCount' threw an exception of type 'System.Runtime.InteropServices.COMException' int {System.Runtime.InteropServices.COMException}
+ ListHeaderCount 'MyDropDown.ListHeaderCount' threw an exception of type 'System.Runtime.InteropServices.COMException' int {System.Runtime.InteropServices.COMException}
+ ListIndex 'MyDropDown.ListIndex' threw an exception of type 'System.Runtime.InteropServices.COMException' int {System.Runtime.InteropServices.COMException}
+ Text 'MyDropDown.Text' threw an exception of type 'System.Runtime.InteropServices.COMException' string {System.Runtime.InteropServices.COMException}
Perhaps more to the point, why should I be using your control and not the one built it to .Net? What are the benefits provided by your wrapper that are not available to me off the shelf in .Net? |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Kevin.
What Office application do you develop the add-in for?
Where is the method called from? Is it called from an event handler?
To add a .NET control to the Office command bar you need to use the 'Toolbar Controls for Microsoft Office' product.
Please visit the following webpage:
http://www.add-in-express.com/office-toolbar-controls/
P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found. |
|
Kevin Curry
Posts: 9
Joined: 2007-01-03
|
I'm creating an AdxCommandBar for Word, Excel, and PowerPoint
this.SupportedApps = ((AddinExpress.MSO.ADXOfficeHostApp)(((AddinExpress.MSO.ADXOfficeHostApp.ohaExcel | AddinExpress.MSO.ADXOfficeHostApp.ohaWord) | AddinExpress.MSO.ADXOfficeHostApp.ohaPowerPoint)));
The command bar has 4 buttons and a drop-down. The test method I pasted earlier is called from an event handler on one of the buttons (i.e., click a button, call a method to populate the drop-down).
I'm using Add-In Express .Net. Do I need another product as well? Pretty much everything else works except occasionally the Add-In doesn't register properly. I've been able to get everything to work with Add-In Express .Net, just not consistently. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Kevin, are you sure that the Enabled property of the drop down list is True when you add new items to the collection? |
|
Kevin Curry
Posts: 9
Joined: 2007-01-03
|
Sergey,
It wasn't! What a rookie mistake.
Sergey, your customer service is amazing. I might have never pulled that out of the documentation. Although I did learn a few things reading it. I retract my question about benefits - they are all clearer to me now.
FYI, the reason it worked occasionally was due to sequences of button events that sometimes enabled the drop down and sometimes disabled it, depending on the context of the event.
Problem solved!
Thank you,
Kevin |
|