Babader7
New member
- Joined
- Oct 5, 2024
- Messages
- 3
- Programming Experience
- Beginner
Hello,
I am a beginner in programming, and I am facing a problem. When loading data from a DataTable to a DataGridView, there is a column in the Data grid view called "status." I want to check if it is "completed." If so, I need to set the checkbox value to true.
I used this code
I load the data via dataTable. DataSource
Iused cell content click event
Thanks for helping.
I am a beginner in programming, and I am facing a problem. When loading data from a DataTable to a DataGridView, there is a column in the Data grid view called "status." I want to check if it is "completed." If so, I need to set the checkbox value to true.
I used this code
C#:
foreach (DataGridViewRow row in dgvTasks.Rows)
{
if (row.Cells["Status"].Value != null && row.Cells["Status"].Value.ToString() == "Pending")
{
row.Cells[0].Value = false;
MessageBox.Show("Y");
}
else
{
row.Cells[0].Value = true;
MessageBox.Show("N");
}
}
I load the data via dataTable. DataSource
Iused cell content click event
Thanks for helping.