How To Get The Selected Hardware Device From The Device Manager Skin

<< Back to the SharedPhidgets page

This is useful, when you want to use the DeviceManagerSkin to let users select a hardware device from the list :

// The DeviceManager skin
GroupLab.SharedPhidgets.DeviceManagerSkin deviceManagerSkin =
  new GroupLab.SharedPhidgets.DeviceManagerSkin();

// The listview object
System.Windows.Forms.ListView listview =

// Now you can use the listview object...
  +=new EventHandler(listview_SelectedIndexChanged);

System.Windows.Forms.ListView.SelectedIndexCollection collection =

Alternatively, the DeviceSelection component can be used to select hardware devices by different means:

private void Create()
  // Create DeviceSelection
  GroupLab.SharedPhidgets.DeviceSelection deviceSelection =
     new GroupLab.SharedPhidgets.DeviceSelection();

  this.deviceSelection.SelectedDeviceChanged +=
    new GroupLab.SharedPhidgets.SelectedDeviceEventHandler(

private void deviceSelection_SelectedDeviceChanged(object sender, GroupLab.SharedPhidgets.SelectedDeviceEventArgs e)
  // ... here, add custom code