1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Combobox in DataGridView

Discussion in 'C#' started by udigold1, Aug 28, 2010.

  1. udigold1

    udigold1 Guest


    I'm trying to setup a DataGridView with ComboBox, but I can't manage to setup the selected value of the combobox.

    The ComboBox value & display members are from table[1] of a Dataset object, and the rest of the datagrid columns are from Table[0] of the dataset. "noseID" (the primary key in Table[1] and the foreign key in Table[0]). How do I apply a selected value for the combobox? Here's my code:

    private void SetupDataGridView()
    DataGridViewComboBoxColumn comboGrid = new DataGridViewComboBoxColumn();
    comboGrid.DataSource = dsRisk.Tables[1];
    comboGrid.DisplayMember = "NoseDesc";
    comboGrid.ValueMember = "NoseID";
    afikimGrid.DataSource = dsRisk.Tables[0];


Share This Page