【发布时间】:2015-04-25 22:38:33
【问题描述】:
基本上,当我将新任务添加到我的列表并显示它时,它工作正常,这是我用来添加新任务并显示任务集的代码:
在 addTask.cs 上添加任务代码:
taskStructure.TasksArray.Add(new taskStructure
{
taskID = taskIDValueTxt.Text,
taskName = taskNameRTB.Text,
taskDescription = taskDescRTB.Text,
taskPriority = checkedButton,
taskDateAndTimeCompletion = finishDateAndTimeDTP.Text,
taskCompleted = mainPage.testerrr
});
testerrr 只是我试图用来获取的公共静态布尔值 通过用户在 DataGridViewCheckBoxCell 中为每个任务选择的值,但这不适用于
testerrr = Convert.ToBoolean(((tasksViewerDGV.Rows[i].Cells["taskCompleted"] as DataGridViewCheckBoxCell).Value));
在 mainPage.cs 上显示任务代码
//Change it from null to the List<T> so the DataGridView can update itself with the new and current task values
taskStructureBindingSource.DataSource = null;
taskStructureBindingSource.DataSource = taskStructure.TasksArray;
基本上,如果用户将任务标记为已完成,我希望该值保留在该特定任务中,例如 True。但是,当我刷新 DataGridView 时,“已勾选”的值会变回 false(未勾选)。无论如何,当我单击该任务的复选框以使其在刷新时保持选中状态时?
基兰
【问题讨论】:
标签: c# datagridview