private void PopulateContacts()
{
adap = new OleDbDataAdapter("SELECT * FROM tblUsers ORDER BY UOnline, UName;", conn);
dt = new DataTable();
adap.Fill(dt);
this.dgvContacts.DataSource = dt;
dgvContacts.Columns[0].Visible = false;
dgvContacts.Columns[1].Width = dgvContacts.Width-3;
dgvContacts.Columns[2].Visible = false;
dgvContacts.Columns[3].Visible = false;
for (int i = 0; i < dgvContacts.RowCount; i++)
{
if (dgvContacts[1, i].Value.ToString() == "True")
{
dgvContacts[2, i].Style.BackColor = Color.Red;
}
else
{
dgvContacts[2, i].Style.BackColor = Color.MediumBlue;
}
}
}
The query returns 2 values. one has a value of online = true, the other is online = false so id expect one to be blue, the other to be red. both appear white and are not changing.
the code doesnt give a warning or anything and i've used this code before wheere it worked fine. i'm completely stumped as to why its now not working in this program.
Thanks