【发布时间】:2012-09-28 16:26:18
【问题描述】:
如何更改DataGridView Windows 窗体中所有单元格的值?我想直接在 Windows 窗体中更改,比如直接在单元格中输入
我有一张这样的桌子:
AA BB CC
--------------
1 aa ac
2 bb fd// I type here and change the value to kk
代码:
DataGridViewTextBoxColumn AA= new DataGridViewTextBoxColumn();
MsgIDHex.HeaderText = "AA";
MsgIDHex.DataPropertyName = "AA";
DataGridViewTextBoxColumn BB= new DataGridViewTextBoxColumn();
MsgIDHex.HeaderText = "BB";
MsgIDHex.DataPropertyName = "BB";
DataGridViewTextBoxColumn CC= new DataGridViewTextBoxColumn();
MsgIDHex.HeaderText = "CC";
MsgIDHex.DataPropertyName = "CC;
dataGridView1.DataSource = result;
dataGridView1.Columns.AddRange(AA, BB, CC};
我应该对DataGridViewTextBoxEditingControl 做点什么吗?
【问题讨论】:
-
不清楚你想做什么,或者什么不起作用。您希望能够在网格上的单元格中输入内容吗?这应该只是工作。当你尝试时会发生什么?
-
对不起,我没有解释的太清楚。感谢 Vyktor,我知道要编辑单元格,我应该编写 dataGridView1.BeginEdit(true);谢谢大家
标签: c# datagridview cell windows-forms-designer