GXDN: Gurux Developer Network
Gurux GXDevice component
In this walkthrough, you learn how to use Gurux GXDevice components (GXDevice) in the Visual Basic environment. GXDeviceSample demonstrates how GXDevice is used in Visual Basic.
Adding GXDevice support to the project
  1. Start Visual Basic
  2. Open the project where you want to add the GXDevice component, or create a new one
  3. Select Components options in the Project menu
  4. Select the GXDevice and click OK to finish


Using components from Visual Basic
To use the GXDevice components, you can either drag the component to the form, or create the component dynamically.


Creating component dynamically
To create component in run time, select References option in Project menu. The dialog shows available components, of which you choose the components to use. In this case select GXDevice. Click OK to finish. The following example shows how to create a GXDevice component.

Dim GXDevice1 As GXDevice
Set GXDevice1 = New GXDevice

Selecting Device and the Media
First select used device and media.

GXDevice1.SelectDevice "GXSNMPSample", "GuruxDevice"
GXDevice1.GXClient.SelectMedia "SNMP"
Dim media As IGXMedia
Set media = GXDevice1.GXClient.GetCurrentMedia()
media.Properties
'Assign new media settings
GXDevice1.GXClient.AssignMedia media

Reading values
After Device and Media are selected, establish the connection. Then read and display the values. When done, close the connection.

GXDevice1.OpenDevice
GXDevice1.ReadValues
Dim prop As GXProperty
For Each prop In GXDevice1.Properties
    MsgBox prop.GetValue(GX_VARTYPE.GX_VT_STR)
Next prop
GXDevice1.Close

Using the components from development environment

Using from .NET | Using from Visual Basic | Using from C++ | Note on parameter types