Compartir a través de


How to: Add Items from Server Explorer

When you drag certain resources from Server Explorer onto Visual Studio designers, the integrated development environment (IDE) automatically creates new components that reference the resources selected. For example, if you drag a message queue from Server Explorer onto a Windows project, the IDE automatically creates a MessageQueue component preconfigured to reference that particular queue. You can then write code that accesses and manipulates data from that queue through this new component.

Creating New Components

To create a new component using Server Explorer

  1. Open the project, form, or class to which you want to add a component in a designer.

  2. In Server Explorer, select the item you want to use.

  3. Drag the item from Server Explorer to the designer surface, or right-click the item and click Add to Designer.

What You Can and Cannot Drag from Server Explorer

The following table lists items that you can drag from Server Explorer, and it describes the components created when you place them onto a Visual Studio project, form, or class designer.

Node type

Items that can be dragged

Result

Servers

Event log categories, message queues, performance counters, and services

For more information, see How to: Add New Servers in Server Explorer.

Event Logs

Event log categories

An EventLog component appears, pointing to the category selected.

Message Queues

Individual message queues

A MessageQueue component appears, pointing to the queue selected.

Performance Counters

Individual counters and instances

A PerformanceCounter component appears, pointing to the counter (and instance) selected.

Services

Individual services

A ServiceController component appears, preconfigured to interact with the service selected.

You cannot drag any data items from Server Explorer. For information on creating data components, see Connecting to Data in Windows Forms Applications, Data Source Configuration Wizard, or Data Sources Window.

You also can create blank components by dragging items from the Toolbox.

To create a new data component using the Toolbox

  1. Select the desired component in the Toolbox.

  2. Drag this component onto a project, form, or class.

    A new, blank instance of the component is created.

  3. Configure the properties of this new component in the Properties window or in your programming code.

See Also

Tasks

How to: Add New Servers in Server Explorer