private void btnAddGroup_Click(object sender, EventArgs e) { FrmEditGroup fEdit = new FrmEditGroup( ); if (fEdit.ShowDialog( ) == DialogResult.OK) { ListViewItem item = new ListViewItem( ); item.Text = fEdit.ReturnName; item.SubItems.Add(""); item.ImageIndex = 1; item.Tag = fEdit.ReturnID; this.lstGroup.Items.Add(item); } }
private void btnEditGroup_Click(object sender, EventArgs e) { if (lstGroup.SelectedItems.Count == 0) { MessageBox.Show("请指定要修改的目标组", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { int groupId = Convert.ToInt32(lstGroup.SelectedItems[0].Tag); FrmEditGroup fEdit = new FrmEditGroup(groupId); if (fEdit.ShowDialog( ) == DialogResult.OK) { lstGroup.SelectedItems[0].Text = fEdit.ReturnName; } } }