how to change text fore color in datagrid view

Oct 17 2014 12:57 AM
public void view_load_tenthclass_marks()
{
//this code for auto resize of columns
dataGridView3.AutoResizeColumns();
dataGridView3.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
ConnectionStringSettings consettings = ConfigurationManager.ConnectionStrings["smssms"];
string connectionString = consettings.ConnectionString;
SqlConnection cn = new SqlConnection(connectionString);
SqlCommand sqlcmd = new SqlCommand();
SqlDataAdapter sda = new SqlDataAdapter();
DataTable dt = new DataTable();
cn.Open();
//pass query
sqlcmd = new SqlCommand(@"select * from tenthclass_marks ", cn);
sda = new SqlDataAdapter(sqlcmd);
//Fill the data in the SQL Data Adapter
sda.Fill(dt);
//Bind it in the DataGrid View
dataGridView3.DataSource = dt;
cn.Close();
}
through this i can get marks of all students now  my requirement is if student get >35 then the text color of that student should change to another color.pls help me
 thank you
 

Answers (2)