获取组合框列的值DataGridView中的valuemember的值 [英] get value of combobox columns valuemember's value in DataGridView

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

问题描述

大家好,

我正在制作一个窗口项目.在页面上,我正在使用datagridview.在datagridview中,我正在使用DataGridViewComboBoxColumn.为此,我使用以下代码

Hi Every One,

I am making a window project. On a Page i am using datagridview. in datagridview i am using a DataGridViewComboBoxColumn. for this i use following code

DataGridViewComboBoxColumn dgvcmb = new DataGridViewComboBoxColumn();
dgvcmb.DisplayMember = "cust_name";
dgvcmb.ValueMember = "cust_ID";



"cust_name"和"cust_id"是两个数据库列.现在,我想在datagridview的"cellbeginedit"和"cellvaluechanged"事件中获取"cust_ID"的值.但是我找不到这个.我没有得到他们的代码.


请帮助我.



"cust_name" and "cust_id" are two database columns. Now i want to get the value of "cust_ID" in "cellbeginedit" and "cellvaluechanged" events of datagridview. but i could not find this. i am not getting code to get them.


please help me.

推荐答案

在这些事件中的任何一个中,您都应该能够像这样获得cust_ID值:
In either one of those events you should be able to get the cust_ID value like this:
( ( DataGridView ) sender ).CurrentCell.Value


获取显示名称:


To get the display name:

( ( DataGridView ) sender ).CurrentCell.EditedFormattedValue


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

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