private void btnEditIdea_Click(object sender, EventArgs e) { answer._currentIndex = lShowAllIdeas.SelectedIndex; frm2 = new FormEditOrAddIdea(); frm2._text = lShowAllIdeas.SelectedItem.ToString(); DialogResult dr = frm2.ShowDialog(this); if (dr == DialogResult.Cancel) { frm2.Close(); } else if (dr == DialogResult.OK) { frm2.Close(); lShowAllIdeas.Items.RemoveAt(answer._currentIndex); lShowAllIdeas.Items.Insert(answer._currentIndex, frm2.GetText()); } }
private void btnAddIdea_Click(object sender, EventArgs e) { frm2 = new FormEditOrAddIdea(); frm2._textOnButton = "Добавить"; DialogResult dr = frm2.ShowDialog(this); if (dr == DialogResult.Cancel) { frm2.Close(); } else if (dr == DialogResult.OK) { frm2.Close(); lAllHypo.Items.Add(frm2.GetText()); } UpdateItemsCount(); }