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
mohammed shamsheer
NA
227
96.8k
GridColor is not displaying according Datagrid value
Oct 28 2014 4:40 AM
public void DatagridColorBasedOnVal()
{
try
{
foreach (DataGridViewRow row in dgvroomStatus.Rows)
{
if (row.Cells["RoomStatus"].Value != null)
{
if (row.Cells["RoomStatus"].Value.ToString() == "Vacant")
{
row.DefaultCellStyle.BackColor = Color.FloralWhite;
}
else if (row.Cells["RoomStatus"].Value.ToString() == "Occupied")
{
Color colour = ColorTranslator.FromHtml("#09F891");
row.DefaultCellStyle.BackColor = colour;//Color.;
}
else if (row.Cells["RoomStatus"].Value.ToString() == "Reserved")
{
Color colour = ColorTranslator.FromHtml("#E0FFFF");
row.DefaultCellStyle.BackColor = colour;
}
}
}
}
catch (Exception ex) { ex.ToString(); }
}
Reply
Answers (
0
)
Enter key clear combobox text when enter key is pressed.
Object reference not set to an instance of an object.