Question

Currently there is a column in my grid that changes background colors when a the grid sort event is called. The bg color changes depending upon the integer value within the cell. Right now it does this with a for loop and has to go through each row and locate the particular cell and check the value. Unless It must execute this bit of code each time the rows are sorted otherwise they go back to default color. I'm looking for a way to write some code that will permanently set the background color of these cells upon creation when the grid is first loaded so that it doesn't have to be set each time a column header is clicked and the data is sorted.

Pas de solution correcte

Autres conseils

Solution to this was to the DataGridView.CellFormating Event Handler.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top