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
David Smith
NA
2k
0
Datagridview painting
Feb 23 2010 2:10 AM
Hi Added this peace of code, Im trying to to just click any cell ,row or column during runtime and highlight with a color.
Instead it highlights everything instead. I think is because of the loop. let me try something else. If you have any ideas please dont hesitate
try
{
colorDialog1.ShowDialog();
for (int i = 0; i < dataGridView2.Rows.Count; i++)
{
/*if (Convert.ToUInt32(dataGridView2.Rows[i].Cells[9].Value) == 0)
{
this.dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}*/
if (Convert.ToUInt32(dataGridView2.Rows[i].Cells[i].Value) == 0)
{
this.dataGridView2.Rows[i].DefaultCellStyle.BackColor = colorDialog1.Color;
}
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
Reply
Answers (
5
)
C# Painting cells, rows , columns at runtime
RGB to HSL conversion