private void gpsListView_ItemActivate(object sender, EventArgs e) { // Get the device ListViewItem selectedItem = gpsListView.Items[gpsListView.SelectedIndices[0]]; Device selectedDevice = (Device)selectedItem.Tag; // And show a new form DeviceForm form = new DeviceForm(); form.CurrentDevice = selectedDevice; form.Show(); }
private void devicesListView_ItemActivate(object sender, EventArgs e) { /* The user can click on any listview item to display more information about * a device. They can also connect to the device and see which features it * supports to make sure it's working properly. */ // Which item was selected? ListViewItem selectedItem = devicesListView.Items[devicesListView.SelectedIndices[0]]; // Get the device object associatede with this listview item Device selectedDevice = (Device)selectedItem.Tag; // Make a new device information form DeviceForm form = new DeviceForm(); // Tell it to use this device form.CurrentDevice = selectedDevice; // And show it form.Show(); }