Gridview cell click leave events

Posted by Oswaldlily under VB.NET on 2/27/2014 | Points: 10 | Views : 1939 | Status : [Member] | Replies : 2
I have datagridview in window application.

when i click first row ,color need to be "red"
when i come to second row,first row shd back to its color(redless) &
second row have to be red..

datagridview_cellclick
{
datagridview.RowsDefaultCellStyle.BackColor = Color.Yellow

}

when i leav the click and comes to next row click,color change coding have to be written under what events?????




Responses

Posted by: Bandi on: 2/28/2014 [Member] [MVP] Platinum | Points: 25
Posted by: Bandi on: 2/28/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer
http://www.codeproject.com/Articles/29489/Use-an-Event-to-Set-the-Row-Cell-BackColor-in-a-Cu
http://forums.codeguru.com/showthread.php?432299-DataGridView-Selected-Row


--Sample
private void tblNewlyDataGridView_CellEnter(object sender, DataGridViewCellEventArgs e)

{

tblNewlyDataGridView[e.ColumnIndex, e.RowIndex].Style

.SelectionBackColor = Color.Green;

}

private void tblNewlyDataGridView_CellLeave(object sender, DataGridViewCellEventArgs e)

{

tblNewlyDataGridView[e.ColumnIndex, e.RowIndex].Style

.SelectionBackColor = Color.HotPink;

}



Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response