private void button_ok_Click(object sender, EventArgs e) { if (Directory.Exists(textBox_path.Text) && textBox_name.Text != "") { this.DialogResult = DialogResult.OK; bool checkbox = checkBox_subdirectory.Checked; CreateProject?.Invoke(this, new NamePathCheckboxEventArgs { Path = textBox_path.Text, Name = textBox_name.Text, Subdirectory = checkbox }); } }