Stored CommandBarButton objects cause Exception from HRESULT: 0x800A01A8 when retrieved

M

Michael R

I have created ComandBarButton objects and I store them in an ArrayList to
keep the Event handler in scope. I would like to set the Visible property
on these objects and thought I could call each ( via an index into the
ArrayList) and set the property. But when I attempt to access any of the
buttons I get the exception: Exception from HRESULT: 0x800A01A8

Any ideas?? Thanks.

basic code:

CommandBarButton oCmdButton = (CommandBarButton)PopUp.Controls[MenuText];
//a valid CommandBarButton that allows me to set all properties
MenuStore.Add(oCmdButton);
....
CommandBarButton oBtn = (CommandBarButton)MenuStore[idx];
oBtn.Visible = true; //causes exception even though oBtn appears to be
valid. (Same reference as MenuStore[idx] which is the same reference as
when the button was created above.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top