DATAGRIDVIEW - BackGround COLOR row

Hi

Excuse me for my english.

I have wrote a script where i charge a file with data in a DATAGRIDVIEW.

Next when i modify some data in the DATAGRIDVIEW i click on a button “GENERATE” for modify somme value.

foreach ($row in $datagridview.Rows)
{
# Traitement
# …
# …

# Update Value
$row.Cells[0].value=$NAME_SERVER
$row.Cells[1].value=$SERVER_ID
$row.Cells[2].value=$MIN_SERVER
$row.Cells[3].value=$MAX_SERVER
$row.Cells[4].value=$SERVER_ID_MIN
$row.Cells[5].value=$SERVER_ID_MAX	

# CHange color of the current row modify
$row.DefaultCellStyle.BackColor = 'cyan'

}

At the end i change the color of the row i some value has modify.

Until this, it’s OK.

But when i have some row with a background color cyan and i click on the title of a column for order, the color disapear…
All the background are white.

Can you explain to me and the solution to keep the colour backupground cyan even if I order on a column?

Thanks for your help,

Matt

https://msdn.microsoft.com/en-us/library/ms171598(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle(v=vs.110).aspx

SelectionBackColor ?

Hi,

Thanks for your reply.

I have change by :
$row.DefaultCellStyle.SelectionBackColor = ‘cyan’

But it’s the same when i click on a column to order the datagrid the color disapear.

Matt