473,395 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Component in Toolbox

Hi

I have a component that inherits from TreeView, my project is a
standard exe. How do i get the component into the toolbox for use
within the project?

I find that only controls based on UserControl apear there
automatically, therefore if i set the component to inherit from
UserControl it will appear, then i change it back to inherit from
TreeView, although it stays, as soon as i close the solition, the next
time i open it the component has gone.

Cheers

Blu
Nov 20 '05 #1
3 3040
Hi,

Add a reference to envdte. This app will add all the controls in
the vbpowerpack to a tab named vb power pack. Hope this helps.
Dim myDTE As EnvDTE.DTE

Dim objToolbox As ToolBox

Dim colTbxTabs As ToolBoxTabs

Dim objTab As ToolBoxTab

Dim colTbxItems As ToolBoxItems

Dim objTbxItem As ToolBoxItem

'

' Open the ide

'

myDTE =
CType(Microsoft.VisualBasic.Interaction.CreateObje ct("VisualStudio.DTE.7.1"),
DTE)

' Create an object reference to the IDE's ToolBox object.

objToolbox = CType(myDTE.Windows.Item(Constants.vsWindowKindToo lbox).Object,
ToolBox)

colTbxTabs = objToolbox.ToolBoxTabs

' look to see if tab exists

Dim bFound As Boolean = False

Dim tbtDelete As ToolBoxTab

For Each t As ToolBoxTab In colTbxTabs

If t.Name = "VB Power Pack" Then

tbtDelete = t

bFound = True

End If

Next

'

' Add tab if needed

'

If bFound Then tbtDelete.Delete()

objTab = colTbxTabs.Add("VB Power Pack")

objTab.Activate()

objTab.ToolBoxItems.Add("Control", AppPath() & "\vbPowerPack.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETCompo nent)

Trace.WriteLine(AppPath)

Timer1.Enabled = True

myDTE.Quit()

Ken
---------------------
"BluDog" <ne**@nospam.bludog.net> wrote in message
news:et********************************@4ax.com...
Hi

I have a component that inherits from TreeView, my project is a
standard exe. How do i get the component into the toolbox for use
within the project?

I find that only controls based on UserControl apear there
automatically, therefore if i set the component to inherit from
UserControl it will appear, then i change it back to inherit from
TreeView, although it stays, as soon as i close the solition, the next
time i open it the component has gone.

Cheers

Blu
Nov 20 '05 #2
JC
I have the similar problem. Adding a text format item to toolbox has no issue, but adding a custom control then it fails.

//succeed.
objTbxItem = objTab. _
ToolBoxItems. _
Add("New Text Item", "Some text to add to the document.",
vsToolBoxItemFormat.vsToolBoxItemFormatText)

// this fails
objTbxItem = objTab. _
ToolBoxItems. _
Add("ui_menu", "c:\ui_menu.dll", vsToolBoxItemFormat.vsToolBoxItemFormatDotNETCompo nent)

"Ken Tucker [MVP]" wrote:
Hi,

Add a reference to envdte. This app will add all the controls in
the vbpowerpack to a tab named vb power pack. Hope this helps.
Dim myDTE As EnvDTE.DTE

Dim objToolbox As ToolBox

Dim colTbxTabs As ToolBoxTabs

Dim objTab As ToolBoxTab

Dim colTbxItems As ToolBoxItems

Dim objTbxItem As ToolBoxItem

'

' Open the ide

'

myDTE =
CType(Microsoft.VisualBasic.Interaction.CreateObje ct("VisualStudio.DTE.7.1"),
DTE)

' Create an object reference to the IDE's ToolBox object.

objToolbox = CType(myDTE.Windows.Item(Constants.vsWindowKindToo lbox).Object,
ToolBox)

colTbxTabs = objToolbox.ToolBoxTabs

' look to see if tab exists

Dim bFound As Boolean = False

Dim tbtDelete As ToolBoxTab

For Each t As ToolBoxTab In colTbxTabs

If t.Name = "VB Power Pack" Then

tbtDelete = t

bFound = True

End If

Next

'

' Add tab if needed

'

If bFound Then tbtDelete.Delete()

objTab = colTbxTabs.Add("VB Power Pack")

objTab.Activate()

objTab.ToolBoxItems.Add("Control", AppPath() & "\vbPowerPack.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETCompo nent)

Trace.WriteLine(AppPath)

Timer1.Enabled = True

myDTE.Quit()

Ken
---------------------
"BluDog" <ne**@nospam.bludog.net> wrote in message
news:et********************************@4ax.com...
Hi

I have a component that inherits from TreeView, my project is a
standard exe. How do i get the component into the toolbox for use
within the project?

I find that only controls based on UserControl apear there
automatically, therefore if i set the component to inherit from
UserControl it will appear, then i change it back to inherit from
TreeView, although it stays, as soon as i close the solition, the next
time i open it the component has gone.

Cheers

Blu

Nov 20 '05 #3
Hi,

Make sure you activate the tab before adding controls to it.

Ken
----------------
"JC" <JC@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
I have the similar problem. Adding a text format item to toolbox has no
issue, but adding a custom control then it fails.

//succeed.
objTbxItem = objTab. _
ToolBoxItems. _
Add("New Text Item", "Some text to add to the
document.",
vsToolBoxItemFormat.vsToolBoxItemFormatText)

// this fails
objTbxItem = objTab. _
ToolBoxItems. _
Add("ui_menu", "c:\ui_menu.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETCompo nent)

"Ken Tucker [MVP]" wrote:
Hi,

Add a reference to envdte. This app will add all the controls in
the vbpowerpack to a tab named vb power pack. Hope this helps.
Dim myDTE As EnvDTE.DTE

Dim objToolbox As ToolBox

Dim colTbxTabs As ToolBoxTabs

Dim objTab As ToolBoxTab

Dim colTbxItems As ToolBoxItems

Dim objTbxItem As ToolBoxItem

'

' Open the ide

'

myDTE =
CType(Microsoft.VisualBasic.Interaction.CreateObje ct("VisualStudio.DTE.7.1"),
DTE)

' Create an object reference to the IDE's ToolBox object.

objToolbox =
CType(myDTE.Windows.Item(Constants.vsWindowKindToo lbox).Object,
ToolBox)

colTbxTabs = objToolbox.ToolBoxTabs

' look to see if tab exists

Dim bFound As Boolean = False

Dim tbtDelete As ToolBoxTab

For Each t As ToolBoxTab In colTbxTabs

If t.Name = "VB Power Pack" Then

tbtDelete = t

bFound = True

End If

Next

'

' Add tab if needed

'

If bFound Then tbtDelete.Delete()

objTab = colTbxTabs.Add("VB Power Pack")

objTab.Activate()

objTab.ToolBoxItems.Add("Control", AppPath() & "\vbPowerPack.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETCompo nent)

Trace.WriteLine(AppPath)

Timer1.Enabled = True

myDTE.Quit()

Ken
---------------------
"BluDog" <ne**@nospam.bludog.net> wrote in message
news:et********************************@4ax.com...
Hi

I have a component that inherits from TreeView, my project is a
standard exe. How do i get the component into the toolbox for use
within the project?

I find that only controls based on UserControl apear there
automatically, therefore if i set the component to inherit from
UserControl it will appear, then i change it back to inherit from
TreeView, although it stays, as soon as i close the solition, the next
time i open it the component has gone.

Cheers

Blu

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: TnCoder | last post by:
Hi; I just moved from vb 6.0 to vb.net. I am trying to add MS Calendar control to my toolbox. After the control is added, it is not enabled. Is there dll I have to add? Can anyone who could give...
1
by: Javier Ros | last post by:
Hi guys!, I´m tring to install my own component in the Visual Studio .Net ToolBox, I have tried with this code: // Create a EnvDTE object. System.Type t =...
1
by: Lauchlan M | last post by:
Hi. I followed the steps suggested below . . . Say I created my component in the namespace "cld.aspnet.components" - where (filepath) would I look for the dll to add in to the toolbox, and...
4
by: Amin Sobati | last post by:
Hi, I have added a component class that inherits System.windows.Forms.TextBox. This component is in the same project as my windows application (executable). I could instantiate it and add to...
9
by: Roman | last post by:
Hello I have a component built in VB.2003. It has the following property: Public Shared mCONN As SqlConnection Public Property Connection() As SqlConnection Get Return mCONN End Get...
1
by: Michael Lang | last post by:
I have a class deriving from System.ComponentModel.Component. In VS 2003 I could drag it on to a web form. However I'm finding in VS 2005 whilst it functions perfectly at runtime. At design...
2
by: alberthung01 | last post by:
Hi all, I wrote a component with ComponentDesigner to let users drag and drop it to WebPage from toolbox directly. Just like the behavior of dataAdapter. But it works fine on ASP.NET 1.1 but not...
2
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, What is the difference between adding a component or a class to a project? In Toolbox, there is a component section, how can be a component added to there? Clara -- thank you so...
18
by: MyMarlboro | last post by:
Hi, How to add existing component to toolbox? i right click my project say AAA and choose the existing component say ABC.cs and then i click ok. then ABC.cs is added to my project. But when i view...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.