Code: Select all
"data source=sqlec; initial catalog=Northwind; integrated security=SSPI; persist security info=False; Trusted_Connection=Yes"
Code: Select all
"data source=sqlec; initial catalog=Northwind; integrated security=SSPI; persist security info=False; Trusted_Connection=Yes"
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
for (int rowIndex = 0; rowIndex < dataGridView1.Rows.Count; rowIndex++)
{
if (dataGridView1.Rows[rowIndex].Cells["msg_status"].Value != null)
{
if ((bool) dataGridView1.Rows[rowIndex].Cells["msg_status"].Value)
{
//read mail
}
else
{
//Unread Mail
dataGridView1.Rows[rowIndex].DefaultCellStyle.Font = new Font(Font.FontFamily, Font.Size,
FontStyle.Bold);
}
}
}
//foreach (DataGridViewRow r in dataGridView1.Rows)
//{
// if ((Convert.ToInt32(r.Cells[6].Value) == 1))
// {
// //Set Row Font to Bold
// r.DefaultCellStyle.Font = new Font("Arial", 12, FontStyle.Bold);
// }
//}
}
Code: Select all
foreach (DataGridViewRow r in dataGridView1.Rows)
{
if ((Convert.ToInt32(r.Cells[3].Value) == 1)) // change 3 to the index of the selection field
{
//Set Row Font to Bold
r.DefaultCellStyle.Font = new Font("Arial", 12, FontStyle.Bold);
}
}