private void taskTrainneeBindingSource_PositionChanged(object sender, EventArgs e) { TaskTrainee taskTrainee = (TaskTrainee)TaskTraineeBindingSource.Current; if (taskTrainee != null) { listBoxTaskProject.SelectedValue = taskTrainee.Title; } }
/// <summary> /// Show TaskTrainee Error /// </summary> private void showTaskTainneeError() { foreach (DataGridViewRow row in dataGridViewTaskTranees.Rows) { TaskTrainee TaskTrainee = (TaskTrainee)row.DataBoundItem; if (TaskTrainee != null) { if (TaskTrainee.Errors.Count() > 0) { row.DefaultCellStyle.BackColor = Color.Red; foreach (DataGridViewCell cell in row.Cells) { cell.ToolTipText = TaskTrainee.ErrorsMessage(); // if (yourCondition) cell.ErrorText = yourErrorText; } } } } }