[英]can i change data grid view combobox column into textbox column?
if (ItemUnitsList.Count == 1)
{
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).DataSource = ItemUnitsList
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).DisplayMember = "UnitName";
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).ValueMember = "UnitId";
how i define default selected item to first index 我如何定义默认选择的项目到第一个索引
}
else if (ItemUnitsList.Count > 1)
{
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).DataSource = ItemUnitsList;
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).DisplayMember = "UnitName";
((DataGridViewComboBoxCell)dataGridView1.Rows[i].Cells[2]).ValueMember = "UnitId";
how i define textchange event to this combobox column 我如何定义此组合框列的textchange事件
}
else
{
MessageBox.Show("NONE");
}
Once a column is created you can't change its type. 创建列后,您将无法更改其类型。 There is no
TextChanged
event for DataGridViewComboboxColumn
. DataGridViewComboboxColumn
没有TextChanged
事件。
If you want to validate any change use the DataGridView.CellValidating
event. 如果要验证任何更改,请使用
DataGridView.CellValidating
事件。
To learn about DataGridView
see the tips given here . 要了解
DataGridView
请参阅此处给出的提示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.