如何在DataGridView的组合框中获取所选项目的值成员 [英] How to get Value Member of Selected Item in Combobox of DataGridView

查看:170
本文介绍了如何在DataGridView的组合框中获取所选项目的值成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个数据网格视图,其中第一列是产品名称,它是一个组合框列.在Form Load中,我在组合框中填充产品名称作为显示成员,产品ID作为值成员.
现在我要做的是,当我从组合框中选择任何产品时,我想显示其相关信息,我正在尝试按产品ID获取它. ???????

I am using A data grid view into which first column is the Product Name which is a Combo box Column. On Form Load i am filling Product names as display member and product id as value member in the combo box.
Now I want to do is when i am selecting any product from combo box i want to display its relate information,i am trying to get it by product id....How to do this?????????????????

推荐答案

环顾ComboBox属性,例如:SelectedValue,SelectedValuePath,DispalyMemberPath,ItemsSource.使用适当的源绑定,您可以非常轻松快捷地完成此操作.我可以为您提供更准确的答案,但需要查看带有DataGrid和ComboBox声明的代码.
Look around ComboBox properties like: SelectedValue, SelectedValuePath, DispalyMemberPath, ItemsSource. With proper sources binding you can do this very quick and easy. I could give you more accurate answer but need to see your code with DataGrid and ComboBox declaration.


这篇关于如何在DataGridView的组合框中获取所选项目的值成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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