本文介绍了获取组合框列的值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.

推荐答案

( ( DataGridView ) sender ).CurrentCell.Value


获取显示名称:


To get the display name:

( ( DataGridView ) sender ).CurrentCell.EditedFormattedValue


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

08-21 06:30