Junior Member
I have problem in my datagrid viewer
I have datagridviewer in C# (platform) and i try that change cell beckground, this cell Should be for example 5 (integer!) if in my datagridwiewer Will be 5(whatwhich should be take in my base_database_) its back color will be for example blue.. please help me.
Sorry for My English. (I am a little).
Contributing Member
Re: I have problem in my datagrid viewer
Hi Smith,
It would be easier to answer if you will be specific about which platform you are working upon. Windows (WinForm or WPF) or Web
---V V---
Vikas Vaidya
Junior Member
Re: I have problem in my datagrid viewer
Here is the sample code for Windows form datagridview; If the cell value is equal or more then the cell color will be green else yello;
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.EndEdit();
if (Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) >= 5)
{
dataGridView1.Rows[e.RowIndex].Cells[ e.ColumnIndex].Style.BackColor = Color.Green;
}
else
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Yellow;
}
}
Sponsored Ads
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules