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
praveen kumar
NA
188
32.4k
Datagridview rows count based on condition
Apr 23 2015 1:16 AM
Hello,
I have changed the backcolor of the rows based on condition, also i have to count the number of rows for the same condition. kindly help me.
this is my code,
try
{
if (e.ColumnIndex == this.dataGridView1.Columns["POST"].Index)
{
string RepVisits = e.Value.ToString();
if (RepVisits != null)
{
if (RepVisits == "M")
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightPink;
}
else if (RepVisits == "P")
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (RepVisits == "S")
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGreen;
}
else if (RepVisits == "F")
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightCyan;
}
else
{
this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
}
}
}
}
catch
{
}
Reply
Answers (
3
)
c# windows forms Creating a triangle
Allow user to edit or delete input list.