在运行时将文本框更改为DataGridView中的组合框 [英] Change A TextBox To Combo Box In DataGridView At Run Time
本文介绍了在运行时将文本框更改为DataGridView中的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先,我应该说我搜索了很多,但没有找到解决方法
我做了这些工作:
1.
First,i should say i searched a lot but i didnt find my solution
i did these works:
1.
this.dataGridView1[1, 1] = new DataGridViewComboBoxCell();
出现此错误:
Got This Error :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
2.
2.
DataGridViewComboBoxCell dgv_cbcell=new DataGridViewComboBoxCell();
dgv_cbcell.Value = null;
dataGridView1.Rows[e.RowIndex].Cells[2] = dgv_cbcell;
dataGridView1.Rows[e.RowIndex].Cells[2].ValueType = dgv_cbcell.ValueType;
出现此错误:
Got This Error :
DataGridViewComboBoxCell value is not valid
推荐答案
您好,
使用"0"作为列索引.
快乐编码:)
Hi there,
use "0" as column index.
Happy Coding :)
这篇关于在运行时将文本框更改为DataGridView中的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文