예제 #1
0
        public frmNameGroup(NameGroupData data)
        {
            InitializeComponent();

            txtName.Text = data == null
                            ? string.Empty
                            : data.Name;

            txtGroup.Text = data == null
                             ? string.Empty
                             : data.Group;
        }
예제 #2
0
        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);
            }
        }