ToolBoxItem Problem

cyuksel

Newcomer
Joined
Mar 14, 2003
Messages
18
Location
turkey
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
 
Does it work if you don't add them as linked? Is there a reason why you're not using the ToolboxItem constructor that just accepts a Type?
 
hi,
i want my toolbox items appeared only when my root designer is active.
When i used AddToolboxItem() method, items are appeared with all project items in the same project.
i want to use toolbox items as the way xml schema do.

thanks.
 
Back
Top