Visual Basic Development Bookmark and Share   
 Home > Visual Basic Power Packs > Multiple User Controls appear in the toolbox
 

Multiple User Controls appear in the toolbox

Hi, iam using visual studio 2008 and when iam using VB.net and i try to add a user control to the toolbox which is fine. i can use this control and nothing is wrong with it but when i build or re-build the project, it creates multiple instences of the same control in the toolbox(basicly the controls are cloning themselfs) after a while i might have 15 usercontrols in the toolbox and it becomes cluttered with copys.Anyone heard of this before?

axel11  Friday, September 11, 2009 1:29 PM

Hi Axel11, how do you add the user control to the toolbox? Could you show your code?
I guess you should not manually add it.

John


John Chen -- See my team blog: http://blogs.msdn.com/vsdata. All my posts are provided "AS IS" with no warranties, and confer no rights.
John Chen MS  Friday, September 11, 2009 2:57 PM

Please Add a Panel to your form and then add your user control to the Panel in this way.

Dim myControl1 As New MyControl1()

Me.panel1.Controls.Add(myControl1)

MyContorl1 is your user control.

you can remove it from the Panel in this way.

If Me.panel1.Controls.Count > 0 Then

Me.panel1.Controls.RemoveAt(0)

End If

Since only one control is shown at a time, so you just need to removeat index 0.

Each time you can clean the panel and then add a control to it.

and here are a sample about it

http://www.codeproject.com/KB/miscctrl/Basic_Bar_Chart.aspx

Best Wshes
Xingwei Hu

Xingwei Hu  Thursday, September 17, 2009 2:58 AM

Hi Axel11, how do you add the user control to the toolbox? Could you show your code?
I guess you should not manually add it.

John


John Chen -- See my team blog: http://blogs.msdn.com/vsdata. All my posts are provided "AS IS" with no warranties, and confer no rights.
John Chen MS  Friday, September 11, 2009 2:57 PM
hey Axel11, I haven't encountered this before, as John said, it's best you could send usyour repro steps or repro project to invstigate.

Bi
Bi Xue  Saturday, September 12, 2009 10:35 AM

Please Add a Panel to your form and then add your user control to the Panel in this way.

Dim myControl1 As New MyControl1()

Me.panel1.Controls.Add(myControl1)

MyContorl1 is your user control.

you can remove it from the Panel in this way.

If Me.panel1.Controls.Count > 0 Then

Me.panel1.Controls.RemoveAt(0)

End If

Since only one control is shown at a time, so you just need to removeat index 0.

Each time you can clean the panel and then add a control to it.

and here are a sample about it

http://www.codeproject.com/KB/miscctrl/Basic_Bar_Chart.aspx

Best Wshes
Xingwei Hu

Xingwei Hu  Thursday, September 17, 2009 2:58 AM
Xingwei,

I am experiencing the same issue that Axel11 had, except that in my case, the multiple instances of toolbox items were created when I ran the Power Pack Installer (VisualBasicPowerPacks3Setup.exe). Before installation, my toolbox was "normal". After installation, I clicked on the Power Pack group and saw a list containing 20 or more items called "PrintForm". Further, those items were the only items in the group, and the one I was interested in (Data Repeater Control) was not in the list.

I instinctively uninstalled the Power Pack, which removed not only the Power Pack group from the Toolbox, but everything else as well. Now, there is only a group named "#13199" in the toolbox, and I have no other items for selectable user controls.

Marc

mr.marc.johnson  Wednesday, September 30, 2009 1:10 PM
...problem resolved. I right clicked on the toolbox pane and selected "reset toolbox". It restored the "general" group. Afterward I right clicked on the toolbox pane and selected "show all", and it fixed the problem. Now, all the power pack options are displayed, as well as the original items (plus some). Hope this helps.
Marc

mr.marc.johnson  Wednesday, September 30, 2009 1:23 PM

You can use google to search for other answers

Custom Search

More Threads

• Getting Data from a textbox in a DataRepeater
• Where Can I get the Visual Basic .NET Power Pack v1 for VB.Net 2003
• Problem generating interopform wrapper class in sub folder
• Did it support drag and drop ?
• Datagrid BindingSource Filter Reverencing Another Datagrid Value
• change line color of powerpack datarepeater which comes after every record
• Adding a new item at the first row when a scrollbar is visible
• XIRR library 100 tries
• Unbound DataRepeater: Update data
• Can not remove the border of the data repeater control