private void DisplayMessageForm(bool isNew = true) { TextBoxForm textForm = new TextBoxForm(); if (!isNew && messageOverrideValue.SelectedIndex != -1) { textForm.TextValue = (string)messageOverrideValue.Items[messageOverrideValue.SelectedIndex].ToString(); } textForm.ShowDialog(); if (textForm.DialogResult == System.Windows.Forms.DialogResult.OK) { if (messageOverrideValue.SelectedIndex > 0) { messageOverrideValue.Items[messageOverrideValue.SelectedIndex] = textForm.TextValue; } else { messageOverrideValue.Items.Add(textForm.TextValue); } } else if (textForm.DialogResult == System.Windows.Forms.DialogResult.Abort) { messageOverrideValue.Items.RemoveAt(messageOverrideValue.SelectedIndex); } else { } textForm.Close(); }
private void addToContainer_Click(object sender, EventArgs e) { TextBoxForm tbf = new TextBoxForm(); tbf.ShowDialog(); if (tbf.DialogResult == System.Windows.Forms.DialogResult.OK) { string values = ((TextBox)tbf.Controls["textBoxValue"]).Text; if (!itemContentsValue.Items.Contains(values)) { itemContentsValue.Items.Add(values); } } else if (tbf.DialogResult == System.Windows.Forms.DialogResult.Cancel) { //do nothing } else if (tbf.DialogResult == System.Windows.Forms.DialogResult.Abort) { //do nothing,because we don't delete from this form } tbf.Close(); }