简体   繁体   English

C#将值/显示添加到DataGridViewComboBoxColumn

[英]c# add values/show to DataGridViewComboBoxColumn

I have a DataGridView which has different rows and columns and it work perfectly when I add values to it 我有一个DataGridView,它具有不同的行和列,当我向其中添加值时,它可以完美地工作

so I have dgv is a DataGridView 所以我有dgv是一个DataGridView

and the following line working perfectly 和下面的行完美地工作

dgv.Rows.Add(setting[0], StringToInteger(setting[1]), setting[2], setting[3], setting[4]);

now the new change is setting[0] it was text cell, now it is DataGridViewComboBoxColumn and I have the values working,Not working, .... and may new things come in the future! 现在新的更改是setting [0],它是文本单元格,现在是DataGridViewComboBoxColumn,我的值在起作用,不起作用,....,将来可能会出现新的情况!

how to solve that 如何解决

how to add a text value that it will show in the DataGridViewComboBoxColumn as a ComboBox ?? 如何添加文本值,它将作为ComboBox显示在DataGridViewComboBoxColumn中?

cheers 干杯

Use a templatefield , 使用模板字段

this way you can bind a value to a new object (in this case a checkbox) trough a function. 这样,您可以通过函数将值绑定到新对象(在本例中为复选框)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM