Beispiel #1
0
        private void buttonEdit_Click(object sender, System.EventArgs e)
        {
            FormEnter form = new FormEnter();

            form.StartPosition = FormStartPosition.CenterParent;
            form.Text          = "Edit";

            ListViewItem listViewItem = fadingListView.SelectedItems[0];

            form.Firstname = listViewItem.SubItems[0].Text;
            form.Lastname  = listViewItem.SubItems[1].Text;
            form.Datatag   = (string)FadingListView.GetTag(listViewItem);
            form.Age       = int.Parse(listViewItem.SubItems[2].Text);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                listViewItem.SubItems[0].Text = form.Firstname;
                listViewItem.SubItems[1].Text = form.Lastname;
                listViewItem.SubItems[2].Text = form.Age.ToString();
                FadingListView.SetTag(listViewItem, form.Datatag);

                fadingListView.ChangeItem(listViewItem);

                textBoxTag.Text = form.Datatag;
            }
        }
Beispiel #2
0
        private void ListView_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            buttonDelete.Enabled = fadingListView.SelectedIndices.Count == 1;
            buttonEdit.Enabled   = fadingListView.SelectedIndices.Count == 1;

            if (fadingListView.SelectedIndices.Count == 1)
            {
                textBoxTag.Text = (string)FadingListView.GetTag(fadingListView.SelectedItems[0]);
            }
        }