Select Item in DataGridViewComboBoxColumn loaded from SQL

前端 未结 1 654
挽巷
挽巷 2021-01-28 16:11

This is SqlDataAdapter that I use for filling dataGridView1 but before I fill it I add DataGridViewComboBoxColumn to that datagridview So

1条回答
  •  粉色の甜心
    2021-01-28 17:04

    Your DataGridViewColumn must be added to DataGridView before you set .DataSource.

    Then set .DataPropertyName for new column:

    cbColumn.DataPropertyName = "PLODINA"
    

    DataPropertyName must be name of the field from "PRONAJEM" table.
    And then item of comboboxcolumn where .ValueMember = PRONAJEM.PLODINA(from DataTable) will be selected

    0 讨论(0)
提交回复
热议问题