private void buttonAdd_Click(object sender, EventArgs e) { EngineeringOrderDirectiveDocumentForm formAdd = new EngineeringOrderDirectiveDocumentForm(columns); if (formAdd.ShowDialog() == DialogResult.OK) { ListViewItem item = new ListViewItem((listView.Items.Count + 1).ToString()); item.SubItems.AddRange(formAdd.Row.ToArray()); item.Tag = formAdd.Row; listView.Items.Add(item); modified = true; } }
private void buttonEdit_Click(object sender, EventArgs e) { ScreenMode mode; if (permissionForUpdate) { mode = ScreenMode.Edit; } else { mode = ScreenMode.View; } EngineeringOrderDirectiveDocumentForm formEdit = new EngineeringOrderDirectiveDocumentForm(columns, SelectedItem, mode); if (formEdit.ShowDialog() == DialogResult.OK) { //source.Items[source.Items.IndexOf(SelectedItem)] = formEdit.Row; ListViewItem item = new ListViewItem(listView.Items[listView.SelectedItems[0].Index].Text); item.SubItems.AddRange(formEdit.Row.ToArray()); item.Tag = formEdit.Row; listView.Items[listView.SelectedItems[0].Index] = item; modified = true; } }