Glossary Item Box

PowerSNMP for .NET

Placing Components on a Form

Although PowerSNMP components can be used in your preferred environment on any machine that has the .NET Framework installed, the recommended method is to use them within the Visual Studio .NET environment.

Use the following steps to create an Agent or Manager component within Visual Studio .NET:

  1. Start Visual Studio .NET.
  2. From the File menu, choose New, then choose Project.
  3. From the resulting dialog box, choose either Visual C# Projects or Visual Basic Projects then choose Windows Application. Specify a name and a location for the project and click OK.
  4. Now add the Agent or Manager component to the form. To do this, right-click on the ToolBox and choose Customize ToolBox (see the screen shot below). If the ToolBox is not visible, navigate to the View menu and choose ToolBox.



  5. Now click the Manager component icon on the ToolBox, and "drag" an instance of it onto the form. The Visual Studio .NET environment will automatically create and instantiate an instance of the component.
  6. Now make a quick application to test. Drag a button and a listbox onto the form.
  7. Add the following code to the button’s "on-click" event handler:
[C#]
using Dart.PowerSNMP;

private void button1_Click(object sender, System.EventArgs e)
{
        // Create a GetRequest message
        GetMessage req = new GetMessage();
        // Add an intrinsic MibObject (to get the system description)
        req.Variables.Add(new Variable(new Dart.PowerSNMP.MibObject.sysDescr()));
        // Send a broadcast request to default port 161 and collect all responses
        ResponseMessage[] responses = manager1.GetResponses(req);
        foreach (ResponseMessage response in responses)
                // Add the system description into listBox1
                listBox1.Items.Add(response.Variables[0].Value);
}
  1. Navigate to the Debug menu and choose Start. The app will compile and execute. Click the button and you should see a list of network agents in the listbox.

 

In This Section

Overview
This topic provides an overview for using PowerSNMP for .NET.
Placing Components on a Form
This topic demonstrates how to create and use the components using Visual Studio .NET.
Creating Components Dynamically
This topic demonstrates how to add a component as a reference using Visual Studio .NET.
Synchronous vs. Asynchronous Use
This topic discusses the benefits and uses for synchronous and asynchronous methods.
Using Events
This topic discusses how to use events with the component, both using Visual Studio .NET and in other environments.
Using Components without Visual Studio
This topic discusses using the components in an environment other than Visual Studio.
Parsing MIB Files
This topic discusses the classes generated when parsing MIB files.
Namespace and Class Hierarchy
This topic discusses the namespace and class hierarchy under Dart.PowerSNMP.

 

 

 


Send comments on this topic.

Documentation version 1.2.0.0.

© 2008 Dart Communications.  All rights reserved.