首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么在datagridview中的cell中自动填入数据(winform)

2012-01-30 
如何在datagridview中的cell中自动填入数据(winform)!例如,当在dgv中插入新行后,在新行中录入人与录入日期

如何在datagridview中的cell中自动填入数据(winform)!
例如,当在dgv中插入新行后,在新行中录入人与录入日期列自动填入当前用户与日期!
谢谢各位!!

[解决办法]

C# code
private void dgv_UserAddRow(.....){  dgv[i,j].value="....";//I行J列;}
[解决办法]
这不是你插入的行号吗?
int nIndex = this.dataGridView1.CurrentCell.RowIndex;
ds.Tables[0].Rows.InsertAt(dr,nIndex ); 

nIndex就是你的行号
[解决办法]
dataGridView1.Rows[?].Cells[?].Value.ToString() = "xxx";
dataGridView1.Rows[?].Cells[?].Value.ToString() = System.DateTime.Now.ToShortDateString();
[解决办法]
探讨
我插入新行用的是:ds.Tables[0].Rows.InsertAt(dr,this.dataGridView1.CurrentCell.RowIndex); 
代码,但取不出新的行号来,请问怎样能取出行号来

热点排行