Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (personsListView.SelectedIndices.Count == 0)
            {
                return;
            }
            Person         p        = pers[personsListView.SelectedIndices[0]];
            EditPersonForm editForm = new EditPersonForm(p);

            if (editForm.ShowDialog() == DialogResult.OK)
            {
                personsListView.Invalidate();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Person         p        = new Person();
            EditPersonForm editForm = new EditPersonForm(p);

            if (editForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            //ListViewItem newItem = personsListView.Add(editForm.FirstName);
            //newItem.SubItems.Add(editForm.Name);
            //newItem.SubItems.Add(editForm.LastName);
            //newItem.SubItems.Add(editForm.Age.ToString());
            personsListView.RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(personsListView_RetrieveVirtualItem);
            pers.Add(p);
            personsListView.VirtualListSize = pers.Count;
            personsListView.Invalidate();
        }