toutouyti
Messages postés20Date d'inscriptiondimanche 6 mai 2012StatutMembreDernière intervention 7 juin 2012
-
22 mai 2012 à 14:53
toutouyti
Messages postés20Date d'inscriptiondimanche 6 mai 2012StatutMembreDernière intervention 7 juin 2012
-
22 mai 2012 à 18:00
Bonjour à tous
Je souhaite gerer les checkboxes de DataGridView
c.à.d. cocher les checkboxes qui ont dans
des line spécifique.
EXP:
j ai deux checkboxes hors de la datagridview
si checkboxes1.checked
alors
tous les checkboxes de les lignes qui ont un champ statut='www'doive etre cocher.
si checkboxes2.checked
alors
tous les checkboxes de les lignes qui ont un champ statut='xxx'doive etre cocher
merci d'avance.
toutouyti
Messages postés20Date d'inscriptiondimanche 6 mai 2012StatutMembreDernière intervention 7 juin 20122 22 mai 2012 à 16:57
merci LUDINSKI
voila mon code et merci de me dir quesque je v ajouter ou modifier
daR = new OracleDataAdapter("requette", cn);
daR.Fill(DSR, "ARTICLE");
dataGridView1.DataSource = DSR;
DataView dv=new DataView(DSR.Tables["ARTICLE"]);
dataGridView1.DataSource = dv;
for (int i = 0; i < DSR.Tables[0].Rows.Count; i++)
{
if (Program.ds.Tables[0].Rows[i]["STOCK_GEN"].ToString() == "")
{
gen = 0;
}
else
if (Program.ds.Tables[0].Rows[i]["STOCK_GEN"].ToString() != "")
{
gen = Convert.ToInt32(Program.ds.Tables[0].Rows[i]["STOCK_GEN"]);
}
if (Program.ds.Tables[3].Rows[i]["ARTI_PRIX_PMP_UE"].ToString() == "")
{
prix = 0;
}
else
if (Program.ds.Tables[3].Rows[i]["ARTI_PRIX_PMP_UE"].ToString() != "")
{
prix = Convert.ToInt32(Program.ds.Tables[3].Rows[i]["ARTI_PRIX_PMP_UE"]);
}
for (int j = 0; j < Program.ds.Tables[1].Columns.Count; j++)
{
if (Program.ds.Tables[1].Rows[i][j].ToString() == "")
{
of_mois = 0;
}
else
if (Program.ds.Tables[1].Rows[i][j].ToString() != "")
{
of_mois = Convert.ToDouble(Program.ds.Tables[1].Rows[i][j]);
}
}
for (int k = 0; k < Program.ds.Tables[2].Columns.Count; k++)
{
if (Program.ds.Tables[2].Rows[i][k].ToString() == "")
{
cmd = 0;
}
else
if (Program.ds.Tables[2].Rows[i][k].ToString() != "")
{
cmd = Convert.ToDouble(Program.ds.Tables[2].Rows[i][k]);
}
}
resultat = (cmd + gen) - of_mois;
if (resultat <= 0)
{dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green; }
else
if (resultat < 10)
{
if (resultat * prix <= 1400 * 11)
{ dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green; }
else
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}
else
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
ce que j veux faire c que j deux checkbox
si je coche le 1er toutes les lignes rouges seront cocher
et si je coche le 2emme toutes les lignes vertes seront chocher
mais je ne sais pas comment je v accéder à les checkbox qui ont dans la datagridview pour ecire les simple mots «checkedbox.checed=true»