How to get selected DataGridViewComboBoxColumn values in vb.net?

╄→гoц情女王★ 提交于 2019-12-13 05:40:01

问题


How to get selected DataGridViewComboBoxColumn values in vb.net?


回答1:


The first link in my google search :-)

How to: Access Objects in a Windows Forms DataGridViewComboBoxCell Drop-Down List

There is a complete example on this MSDN page.

Specifically note the following regarding getting the selected values

Unlike the ComboBox control, the DataGridView types do not have a SelectedItem propertyfor retrieving the currently selected object. Instead, you must set the System.Windows.Forms.DataGridViewComboBoxColumn.ValueMember or System.Windows.Forms.DataGridViewComboBoxCell.ValueMember property to the name of a property on your business object. When the user makes a selection, the indicated property of the business object sets the cell Value property.

Click on "VB" in the code boxes to see the appropriate VB.net code syntax



来源:https://stackoverflow.com/questions/4394769/how-to-get-selected-datagridviewcomboboxcolumn-values-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!