private void bnDelete_Click(object sender, EventArgs e) { try { if (listViewCardboardFormats.SelectedIndices.Count > 0) { // delete selected cardboard profile int iSel = this.listViewCardboardFormats.SelectedIndices[0]; ListViewItem item = listViewCardboardFormats.Items[iSel]; // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // get selected cardboard format and remove DCCardboadFormat cf = client.GetCardboardFormatByID((int)item.Tag); if (null != cf) { client.RemoveCardboardFormat(cf); } // fill list view again FillListView(); // select first item if (listViewCardboardFormats.Items.Count > 0) { listViewCardboardFormats.Items[0].Selected = true; } } } catch (Exception ex) { _log.Error(ex.ToString()); } }