1
votes

I have a combobox and a textbox to filter my data and show them in a datagridview:

    AFDBEntities adbe = new AFDBEntities();

    private void btnSearch_Click(object sender, EventArgs e)
    {

        var cbo = cmbInstallers.Text;
        switch (cbo){
            case "First Name":
                var ianst = (from x in adbe.TblInstallers
                         where x.FirstName.Contains(txtSearch.Text)
                         select x).ToList();
                dgvSearched.DataSource = ianst;
    }

and now when I have for example 4 results that contains "x", they all shown in datagridview. I want to make right click option on datagridview that gives me a menu for opening a new form to edit selected row of results.

Picture of Form

1

1 Answers

1
votes

You need to assign a context Menu to you DataGridView and then monitor its events through the Editing_Control_Showing Event Handle on the DataGridView.