private void Form6_Load(object sender, EventArgs e) { dataGridView1.DataSource = BL.DemmandeBL.Instance.GetAllDemande(); cmbAjent.DisplayMember = "Nom"; cmbAjent.ValueMember = "id"; cmbAjent.DataSource = BL.AgentBL.Instance.GetAllAgent(); dataGridView1.CellDoubleClick -= dataGridView1_CellDoubleClick; //cmbAjent.SelectedValueChanged += (ss, ee) => //{ // if (cmbAjent.SelectedIndex != -1 && cmbAjent.SelectedValue != null) // { // int idAgent = (int)cmbAjent.SelectedValue; // dataGridView1.DataSource = BL.DemmandeBL.Instance.GetAllDemande().Where(x => x.id_agent == idAgent).ToList(); // } //}; dataGridView1.CellDoubleClick += (ss, ee) => { var dem = dataGridView1.Rows[ee.RowIndex].DataBoundItem as MODEL.Demande; if (dem != null) { var frm = new Print.DemandeIMP(dem); frm.StartPosition = FormStartPosition.CenterParent; frm.ShowDialog(); } }; }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { var frm = new Print.DemandeIMP(); frm.ShowDialog(); }