Visual Studio .NET provides a very interesting view of the world named the Server Explorer (which can be activated from the View menu). While you may already be aware many of these items can be opened within VS .NET for editing (for example, opening a database Table or editing a stored procedure), you may not know that everything is dragable. Let's say you know your application needs to interact with a machine's application event log. Simply open the Event Logs tree and drag the Application icon onto a Forms designer. VS .NET responds by declaring a member variable of type System.Diagnostics.EventLog and modifying InitializeComponent() appropriately:

this.eventLog1.Log = "Application";
this.eventLog1.MachineName = "MainHomeBox";
this.eventLog1.SynchronizingObject = this; 

This same behavior holds true for any icon. To take things out for a test drive, try dragging over an icon representing a stored procedure, Windows Service or Message Queue.


Tip from Andrew Troelsen
Posted by: Duncan Mackenzie, MSDN
This post applies to Visual C# .NET 2002/2003