public frmNameGroup(NameGroupData data) { InitializeComponent(); txtName.Text = data == null ? string.Empty : data.Name; txtGroup.Text = data == null ? string.Empty : data.Group; }
private void tsmiAddNameGroup_Click(object sender, EventArgs e) { var lv = GetListViewFromToolStripDropDownItem(sender); using (var frm = new frmNameGroup()) { if (frm.ShowDialog() != DialogResult.OK) { return; } var nameGroup = new NameGroupData { Name = frm.NameValue, Group = frm.GroupValue }; var item = new ListViewItem(nameGroup.Name) { Tag = nameGroup }; item.SubItems.Add(nameGroup.Group); lv.Items.Add(item); } }