将数据绑定到DataGridViewComboBoxColumn [英] binding data to DataGridViewComboBoxColumn

查看:79
本文介绍了将数据绑定到DataGridViewComboBoxColumn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有datagridview.我将datacolum类型更改为DataGridViewComboBoxColumn;

但是当我将数据源绑定到我的datagrid时出现此错误:datagridview中发生以下异常.
system.ArgumentException:DataGridViewComboBoxCell值无效

要替换此defult对话框,请处理dataerror事件;


您可以帮我吗?

Hi

I have datagridview. I was change datacolum type to DataGridViewComboBoxColumn;

but when I binding datasource to my datagrid have this error :the following exception occurred in the datagridview .
system.ArgumentException:DataGridViewComboBoxCell value is not valid

to replace this defult dialog please handle the dataerror event;


Can you Help me?

推荐答案

创建一列组合框时,必须为这些组合指定一个项目列表,这些列表将在您选择时显示.进入dgv单元格的值必须在该项目列表中.在您的情况下,一个或多个组合框单元格包含一个不在项目列表中的值,因此该单元格值无效.
When you create a column of combo boxes, those combos must be assigned a list of items which will be displayed when you select it. The value which goes into the dgv cell must be in that list of items. In your case, one or more of the combo box cells contains a value which is not in the item list, hence the cell value is invalid.


这篇关于将数据绑定到DataGridViewComboBoxColumn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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