Creating CommandBar at runtime?

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

Creating CommandBar at runtime?
 
Steve Weixel




Posts: 14
Joined: 2005-05-04
Hi Sven,

I'm actually not putting any code in the InitializeComponent, I'm just letting the designer do its thing. Its just that when you want to create a commandbar, you have to give it your form's ComponentModel.Container, but the container object returned by GetContainer is Nothing because there is a bug in the ADX code generation that omits the line "Me.components = New System.ComponentModel.Container" in InitializeComponent when there are no controls "drawn" in the designer.

It DOES include that line when you first create the project, it only goes away if you add a control in the designer and then remove it, causing ADX to regenerate the code in InitializeComponent. My workaround is simply to make sure that I have a control in the designer (e.g. an events control) so that the components object gets created in InitializeComponent. But I was also pointing out that it should be sufficient to manually construct a componentmodel.container and assign it to the components object in the constructor if I didn't have any designed controls.
Posted 12 May, 2005 12:30:05 Top
Sven Heitmann




Posts: 193
Joined: 2004-08-23
Sorry Steve, lazy German ;)

When I wrote this
Steve, you can also add your code to the constructor directly.
InitializeComponent is just for the designer.

I meant the initialization of the Container Object in the constructor, like you did. =)

Best regards,

Sven Heitmann
Posted 13 May, 2005 02:36:10 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Steve.

there is a bug in the ADX code generation that omits the line "Me.components = New System.ComponentModel.Container"


The point is that the VS designer omits this line automatically when a component module doesn't contain any components. But we will fix this behaviour in the next ADX build.
Posted 13 May, 2005 05:06:16 Top
Guest


Guest


Sergy,

I'm sorry, I wasn't meaning to assign blame, I was just trying to make it clear that the problem was the absence of that line.
Posted 13 May, 2005 11:02:55 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Steve.
No problem. I just wanted to inform our customers that the issue will be fixed in the next build. We are hignly interested in any bug reports because we would like to improve ADX as far as possible.
Posted 13 May, 2005 14:02:39 Top