Reputation: 11
I have a DataGridView with four columns: Eng, Swe, update and hide.
End and Swe are normal strings and update and hide are checkboxes.
I want to make two buttons now:
Button1: "Update all" this button shall loop through all the checkboxes in the column update update and set the value to true (checked).
Button2: "Hide" this button shall loop through all the checkboxes in the column hide and set the value to true (checked).
Can anyone please help me how to do this, how to make the program understand that when I press Button1 that all the checkboxes in the column "Update" shall be checked.
I appreciate all the help.
Upvotes: 1
Views: 4048
Reputation: 4801
private void UpdateAllButton_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
row.Cells["update"].Value = true;
}
}
private void HideButton_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
row.Cells["hide"].Value = true;
}
}
Upvotes: 2