private void dtQuestions_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == YoutubeClnIndex && e.RowIndex > 0) { var question = dtQuestions.Rows[e.RowIndex].DataBoundItem as question; if (!String.IsNullOrEmpty(question.youtube_link)) { var form = new YoutubeForm(question.youtube_link); form.ShowDialog(this); } } }
private void dtQuestions_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } var questionObject = dtQuestions.Rows[e.RowIndex]?.DataBoundItem as question; if (e.ColumnIndex == DeleteColumnNumber) { var dialog = new AreYouSurePopup("Da li ste sigurni da želite da obrišete pitanje?"); dialog.ShowDialog(this); if (dialog.Success) { questionObject.deleted = 1; loadDB(); } } else if (e.ColumnIndex == YoutubeVideoColumnNumber && !string.IsNullOrEmpty(questionObject?.youtube_link)) { Form yt = new YoutubeForm(questionObject.youtube_link); yt.ShowDialog(this); } }