[英]How to get selected DataGridViewComboBoxColumn values in vb.net?
如何在vb.net中获取选定的DataGridViewComboBoxColumn值?
The first link in my google search :-) 谷歌搜索中的第一个链接:-)
How to: Access Objects in a Windows Forms DataGridViewComboBoxCell Drop-Down List 如何:访问Windows窗体DataGridViewComboBoxCell下拉列表中的对象
There is a complete example on this MSDN page. 这个MSDN页面上有一个完整的例子。
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.
与ComboBox控件不同,DataGridView类型没有SelectedItem属性来检索当前选定的对象。 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.
相反,必须将System.Windows.Forms.DataGridViewComboBoxColumn.ValueMember或System.Windows.Forms.DataGridViewComboBoxCell.ValueMember属性设置为业务对象上的属性名称。 When the user makes a selection, the indicated property of the business object sets the cell Value property.
当用户进行选择时,业务对象的指示属性设置单元格Value属性。
Click on "VB" in the code boxes to see the appropriate VB.net code syntax 单击代码框中的“VB”以查看相应的VB.net代码语法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.