private void lstvCriteria_DoubleClick(object sender, EventArgs e) { int selectIndex = lstvCriteria.SelectedIndices[0]; int itemIndex = (int)lstvCriteria.SelectedItems[0].Tag; FQueryCriteria frm = new FQueryCriteria(this, criteriaList, itemIndex); frm.Text = "Edit Criteria Item"; frm.ShowDialog(this); lstvCriteria.Items[selectIndex].Selected = true; }
private void btnCriteriaAdd_Click(object sender, EventArgs e) { int count = criteriaList.Count; FQueryCriteria frm = new FQueryCriteria(this, criteriaList); frm.Text = "Add Criteria Item"; frm.ShowDialog(this); if (criteriaList.Count > count) { int i = 0; foreach (ListViewItem viewItem in lstvCriteria.Items) { if ((int)viewItem.Tag == count) { lstvCriteria.Items[i].Selected = true; break; } i++; } } }