private void btnAdd_Click(object sender, EventArgs e) { StateAddcs newForm = new StateAddcs(); DialogResult = newForm.ShowDialog(); if (DialogResult == DialogResult.OK) { lbStates.Items.Add(newForm.state); } }
private void btnChange_Click(object sender, EventArgs e) { if (lbStates.SelectedIndex != -1) { StateAddcs newForm = new StateAddcs(); DialogResult dialogResult = newForm.ShowDialog(); if (dialogResult == DialogResult.OK) { lbStates.Items.RemoveAt(lbStates.SelectedIndex); } lbStates.Items.Add(newForm.state); } }