private void addCommentBtn_Click(object sender, EventArgs e) { if (new ItemCheck(nameSurnameEmailComboBox.SelectedItem, moviesComboBox.SelectedItem, commentTxtBox.Text, commentDateTimePicker.Value).CommentCheck() == true) { //error, do nothing } else { if (MessageBox.Show("Do you want to add this comment to database?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string name = nameSurnameEmailComboBox.SelectedItem.ToString().Split(' ')[0]; string secondName = nameSurnameEmailComboBox.SelectedItem.ToString().Split(' ', ',')[1]; string email = nameSurnameEmailComboBox.SelectedItem.ToString().Substring(nameSurnameEmailComboBox.SelectedItem.ToString().LastIndexOf(',') + 2); string movieTitle = moviesComboBox.SelectedItem.ToString(); string contents = commentTxtBox.Text; DateTime addDate = commentDateTimePicker.Value; BsonDocument _document = DBItem.Comment(name, secondName, email, movieTitle, contents, addDate); NewComment = _document; MovieTitle = movieTitle; UserEmail = email; this.DialogResult = DialogResult.Yes; } else { //do nothing } } }