1

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.

1 Answer 1

2
    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;
        }
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.