hi,
i used AddLinkedToolBoxItem() function to add my toolbox item. i want to add more than one items at the same time. but my RootDesigner cannot add all of them. it only adds the last item.
Here is my code:
private void OnLoadComplete(object sender, EventArgs e)
{
IDesignerHost host = (IDesignerHost)sender;
host.LoadComplete -= new EventHandler(this.OnLoadComplete);
IToolboxService tbx = (IToolboxService)GetService(typeof(IToolboxService));
if (tbx != null)
{
ToolboxItem item1 = new ToolboxItem();
ToolboxItem item2 = new ToolboxItem();
item1.TypeName = "ValidationLibrary.NumberValidator" ;
item1.DisplayName = "NumberValidator";
item2.TypeName = "ValidationLibrary.StringValidator" ;
item2.DisplayName = "StringValidator";
item1.Lock();
tbx.AddLinkedToolboxItem(item1, "Validator", host);
item2.Lock();
tbx.AddLinkedToolboxItem(item2,"Validator", host);
}
Is there anything wrong?
Thanks
i used AddLinkedToolBoxItem() function to add my toolbox item. i want to add more than one items at the same time. but my RootDesigner cannot add all of them. it only adds the last item.
Here is my code:
private void OnLoadComplete(object sender, EventArgs e)
{
IDesignerHost host = (IDesignerHost)sender;
host.LoadComplete -= new EventHandler(this.OnLoadComplete);
IToolboxService tbx = (IToolboxService)GetService(typeof(IToolboxService));
if (tbx != null)
{
ToolboxItem item1 = new ToolboxItem();
ToolboxItem item2 = new ToolboxItem();
item1.TypeName = "ValidationLibrary.NumberValidator" ;
item1.DisplayName = "NumberValidator";
item2.TypeName = "ValidationLibrary.StringValidator" ;
item2.DisplayName = "StringValidator";
item1.Lock();
tbx.AddLinkedToolboxItem(item1, "Validator", host);
item2.Lock();
tbx.AddLinkedToolboxItem(item2,"Validator", host);
}
Is there anything wrong?
Thanks