private void ButtonAddKeyword_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TextboxBefore.Text) && !string.IsNullOrEmpty(TextboxAfter.Text)) { var keyword = new Keywords() { Before = TextboxBefore.Text, After = TextboxAfter.Text }; SettingsManager.AddKeyword(keyword); DialogResult = DialogResult.OK; Close(); } }