cyuksel Posted April 3, 2003 Posted April 3, 2003 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 Quote
*Gurus* divil Posted April 3, 2003 *Gurus* Posted April 3, 2003 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? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
cyuksel Posted April 4, 2003 Author Posted April 4, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.