我有一个DataGridView
,其中的行通过单击按钮动态添加。这些行的单元格为ReadOnly
。当我选择特定行时,我希望通过单击按钮可以单击这些单元格。这意味着所选行的单元格应该是可单击的。有可能吗?如果是这样我可以得到一个例子吗?
int currentColumCount = Int32.Parse(addModule.numberOfAssessmentsMaskedTextBox.Text);
for (int i = assessmentDataTableOnFour.Columns.Count - 1; i < currentColumCount; i++)
{
DataColumn column = assessmentDataTableOnFour.Columns.Add("Assesment " + (i + 1));
assessmentDataGridViewOnFour.ReadOnly = true;
}
addAssessmentButtonOnFour.Enabled = true;
assessmentDataTableOnFour.Rows.Add(new string[]
{
addModule.ModuleNameTextBox.Text + " : " + addModule.ModuleCodeTextBox.Text + " : " + addModule.ModuleCreditsTextBox.Text + " credits"
});
private void addAssessmentButtonClickedOnFour(object sender, EventArgs e)
{
foreach (DataGridViewRow row in assessmentDataGridViewOnFour.SelectedRows)
{
assessmentDataGridViewOnFour.ReadOnly = false;
assessmentDataGridViewOnFour.Columns["Module Details"].ReadOnly = true;
}
}