如何在vb.net中获取选定的DataGridViewComboBoxColumn值? [英] How to get selected DataGridViewComboBoxColumn values in vb.net?

查看:284
本文介绍了如何在vb.net中获取选定的DataGridViewComboBoxColumn值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vb.net中获取选定的DataGridViewComboBoxColumn值?

How to get selected DataGridViewComboBoxColumn values in vb.net?

推荐答案

我的Google搜索中的第一个链接:-)

The first link in my google search :-)

如何:访问Windows窗体DataGridViewComboBoxCell下拉列表中的对象

此MSDN页面上有完整的示例。

There is a complete example on this MSDN page.

特别注意以下有关获取选定值的

Specifically note the following regarding getting the selected values


与ComboBox控件不同,
DataGridView类型不具有
SelectedItem属性来检索当前所选对象

相反,必须将
System.Windows.Forms.DataGridViewComboBoxColumn.ValueMember

System.Windows.Forms.DataGridViewComboBoxCell.ValueMember
属性设置为
您的业务对象上的财产。当用户
进行选择时,指示的业务对象
属性将
设置为单元格Value属性。

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.

在代码框中单击 VB以查看适当的VB.net代码语法

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

这篇关于如何在vb.net中获取选定的DataGridViewComboBoxColumn值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆