public InfoArticle(string Code) { InitializeComponent(); Save = false; DB_PostgreSQL dataBase = new DB_PostgreSQL(); c1Combo1.DataSource = dataBase.returnDataSet("SELECT \"Code\",\"Libelle\" FROM \"Famille\"").Tables[0]; c1Combo1.DisplayMember = "Libelle"; c1Combo1.ValueMember = "Code"; currentArticle.FindByKey(Code); SetChamp(currentArticle); btnOK.Enabled = false; }
private void Supprimer_Click(object sender, EventArgs e) { if (MessageBox.Show("Vous ete sure de vouloire Supprimer cette article ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes) { int index = c1TrueDBGrid1.Row; string Code = c1TrueDBGrid1.Columns["Code"].CellText(index); if (Code == null) { MessageBox.Show("Code Vide"); return; } TB_Articles Ar = new TB_Articles(); Ar.FindByKey(Code); Ar.DeleteData(); ((DataTable)c1TrueDBGrid1.DataSource).Rows.Find(Code).Delete(); } }