TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vikas Ahlawat
NA
564
817.8k
Datagridview Row backcolor problem
Apr 20 2012 2:49 AM
Hi I am facing problem in changing datagridview rows color based on data. but in my datagrid last row containing total so I don't want to apply any background color on it.
I sent the cor or cellRormatting event of datagridview
Here I am using
(e.RowIndex
!= dgvRoomTypeSeven.Rows.Count-1) to check that it is last row.
but
e.RowIndex always gives 0 why?
private void dgvRoomTypeSeven_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex != 0 &&
e.RowIndex
!= dgvRoomTypeSeven.Rows.Count-1)
{
if (e.Value.ToString() == "N/A") e.CellStyle.BackColor = Color.Red;
else
e.CellStyle.BackColor = Color.Green;
}
}
Is there any other way?
Reply
Answers (
5
)
Matching--> please reply
Consume web service behind firewall