문제

This is with respect to the language C#.

I want to use the last column in a DataGridView as a color column. The Row in the list will have some data and the last column cell of that row will have a color to represent if it is right or wrong, good or bad. (something like that) Is it possible to do this and how (if possible)?

도움이 되었습니까?

해결책

After setting datasource, you may use-

        foreach (DataGridViewRow row in yourDataGridView.Rows)
        {
            if (row.Cells[LastColumnIndex].Value == YourValue)
            {
                row.Cells[LastColumnIndex].Style.BackColor = Color.Red;
            }
        }

Hope, you have got the idea.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top