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

发布于 2024-10-06 22:19:06 字数 54 浏览 0 评论 0原文

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

How to get selected DataGridViewComboBoxColumn values in vb.net?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆那么伤 2024-10-13 22:19:06

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

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

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

关于获取所选值,请特别注意以下事项

与 ComboBox 控件不同,
DataGridView 类型没有
用于检索的 SelectedItem 属性
当前选定的对象。
相反,您必须设置
System.Windows.Forms.DataGridViewComboBoxColumn.ValueMember
或者
System.Windows.Forms.DataGridViewComboBoxCell.ValueMember
属性到属性的名称
您的业​​务对象。当用户
进行选择,指示
业务对象集的属性
单元格 Value 属性。

单击代码框中的“VB”可查看相应的 VB.net 代码语法

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文