如何在datagridview单元格中存储datagridview组合框列值 [英] how to store the datagridview comboboxcolumn value in datagridview cell

查看:97
本文介绍了如何在datagridview单元格中存储datagridview组合框列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我已经创建了一个combox并将其添加到datagridviewcell中.当我从combox中选择值时.选定的值不会显示在该单元格上.如果我继续到下一个单元格.如果有人知道如何在其中存储组合框选定的值datagridview
单元格.

解决方案

DataGridViewComboBoxColumn DisplayMember ValueMember 属性应像
那样适当地设置.

 comboboxColumn.DataSource = RetrieveAlternativeTitles();
comboboxColumn.ValueMember = ColumnName.TitleOfCourtesy.ToString();
comboboxColumn.DisplayMember = comboboxColumn.ValueMember; 


如此处给出的
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.aspx#Y3747 [ ^ ]


hi i have created a combox and add it to the datagridviewcell .when i select the value from the combox .the selected value is not displayed on that cell.if i move on to next cell.if anyone knows how to store the combobox selected value in datagridview
cell.

help me.

解决方案

The DisplayMember and ValueMember properties of the DataGridViewComboBoxColumn are to be set appropriately like

comboboxColumn.DataSource = RetrieveAlternativeTitles();
comboboxColumn.ValueMember = ColumnName.TitleOfCourtesy.ToString();
comboboxColumn.DisplayMember = comboboxColumn.ValueMember;


as given here
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.aspx#Y3747[^]


这篇关于如何在datagridview单元格中存储datagridview组合框列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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