使用普通列在Datagridviewcomboboxcoloumn中添加值 [英] Add value in Datagridviewcomboboxcoloumn with normal column
本文介绍了使用普通列在Datagridviewcomboboxcoloumn中添加值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个datagridview.
将一个comboboxcolumn名称添加为month,将一个普通列名称添加为days
我曾经使用过代码
datagridview1.rows.add(new object(){","31"})
运行项目时,组合框列显示为空白
但是当我执行下拉菜单时,则显示整个月
我想要在组合框列中添加值
I have take one datagridview.
Add one comboboxcolumn name as month and one normal column name as days
I had use code
datagridview1.rows.add(new object() {" ","31"})
When run the project the combobox column is show blank
but when i do dropdown then show all month
i want a add value in the combobox column
How do that?
推荐答案
您必须向datagridview添加某种数据源.然后将月份添加到此数据源的记录中.
例如:
创建一个bindingList,其中包含一个对象数组.这些对象代表您要显示的月份.
当您向该bindingList添加新对象时,该新对象的属性将显示在datagridview的列中.
You must add some sort of datasource to the datagridview. Then add the month to a record of this datasource.
for example:
create a bindingList which contains an array of objects. These objects represent the months you want to display.
When you add a new object to this bindingList, the properties of this new object will be shown in the columns of the datagridview.
这篇关于使用普通列在Datagridviewcomboboxcoloumn中添加值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文