C# Datagridview: get selected item in combobox columns

前端 未结 6 907
遇见更好的自我
遇见更好的自我 2021-01-14 08:46

I\'m working on a GUI that allows the user to manipulate xml files. I display the xml file in a datagridview organized neatly by columns through xml elements. I allow the us

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 09:33

    Use this to get or set selected value:

    object selectedValue = currentRow.Cells["comboboxColumnName"].Value
    

    Don't forget to set DisplayMember and ValueMember for your DataGridViewComboBoxColumn

提交回复
热议问题