PDA

View Full Version : رنگ کردن یک ستون از dataGridview



navidiran
دوشنبه 03 آبان 1389, 09:39 صبح
سلام. می خوام یک ستون از دیتاگریدم رو رنگی نشون بدم. میشه یکی بگه این کدی که نوشتم کجاش ایراد داره که کار نمی کنه؟




foreach (DataGridViewColumn col1 in dataGridView1.Columns)
{

if (col1.HeaderText.ToString().Trim() == "") { col1.InheritedStyle.BackColor = Color.Red; }
}

ایمان مدائنی
دوشنبه 03 آبان 1389, 09:53 صبح
dataGridView1.Columns[1].DefaultCellStyle.BackColor = Color.GreenYellow;