public void RaffraichirGrid() { DGVTypeDocument.Rows.Clear(); DAL.DALTypeDocument D = new DAL.DALTypeDocument(); dt = D.SelectAllTypeDocument(); int taille = dt.Rows.Count; if (taille > 0) { for (int i = 0; i < taille; i++) { DGVTypeDocument.Rows.Add(dt.Rows[i][1].ToString().Trim(), dt.Rows[i][2].ToString().Trim(), dt.Rows[i][3].ToString().Trim()); } } }
public GestionDocument(int id1, int mode1) { InitializeComponent(); ID = id1; MODE = mode1; if (MODE != 0) { panelModifDoc.Visible = true; button1.Enabled = false; txtDocument.Enabled = false; //int x = DGVDocument.CurrentRow.Index; //int IdDoc = int.Parse(dt.Rows[x][0].ToString()); //DataTable dt1 = new DataTable(); //DAL.DALDocuments d = new DAL.DALDocuments(); //dt1 = d.SelectDocumentById(IdDoc); //cmbTypeDocument.SelectedValue = int.Parse(dt1.Rows[0][3].ToString()); //txtNomFr.Text = dt1.Rows[0][4].ToString().Trim(); //txtNomAr.Text = dt1.Rows[0][5].ToString().Trim(); //txtCommentaire.Text = dt1.Rows[0][6].ToString().Trim(); //txtDocument.Text = dt1.Rows[0][7].ToString().Trim(); } else { panelModifDoc.Visible = true; button1.Enabled = true; txtDocument.Enabled = true; cmbTypeDocument.SelectedIndex = -1; txtNomFr.Text = ""; txtNomAr.Text = ""; txtCommentaire.Text = ""; txtDocument.Text = ""; } DataTable dt287 = new DataTable(); DAL.DALTypeDocument t = new DAL.DALTypeDocument(); dt287 = t.SelectAllTypeDocument(); cmbTypeDocument.DataSource = dt287; cmbTypeDocument.ValueMember = "IdTypeDocument"; cmbTypeDocument.DisplayMember = "Code"; }