DataGrid1[DataGrid1.CurrentRowIndex,1]; 这个是什么?不懂
解决方案 »
- 求 C#高级编程 第6版 pdf 下载地址
- 【算法】求从多个名字中剔除重复名字(只留一个)的算法,汉字大约十五万
- 用c#定义自己的 user control按钮
- 关于HASH算法得到固定范围的数字
- 保存JPG图片问题
- C#
- 谁可以给我一个些winform关于文件管理的源码?
- 用SandCastle生成的help2文件,HxS等,在VS环境下按F1就可用?
- 在WinForm中前台文本框中的数值怎样转换成数据库中money类型?
- 关于panel的点击事件.
- 为什么我的DataList控件会不接受样式呢?CssClass居然无效哦!
- 在.net的c#里添加.ocx控件的引用如何后使用控件的OnEvent事件?
drAdd[2] = DataGrid1[DataGrid1.CurrentRowIndex,2]].ToString();
drAdd[0] = DataGrid1[DataGrid1.CurrentRowIndex,0];
drAdd[1] = DataGrid1[DataGrid1.CurrentRowIndex,1];
在试试。
string tmp2 = drAdd[2] = DataGrid1[DataGrid1.CurrentRowIndex,2] as string;然后跟踪一下看看tmp1,tmp2的值
原因:DataSet1已经绑定到DataGrid1上了,不需要再NewRow
DataRow drAdd = DataSet1.Tables["base"].NewRow();
drAdd[1] = DataGrid1[DataGrid1.CurrentRowIndex,1];
drAdd[2] = DataGrid1[DataGrid1.CurrentRowIndex,2];
DataSet1.Tables["base"].Rows.Add(drAdd);
自己搞定,谢谢各位~~
原因:DataSet1已经绑定到DataGrid1上了,不需要再NewRow
DataRow drAdd = DataSet1.Tables["base"].NewRow();
drAdd[1] = DataGrid1[DataGrid1.CurrentRowIndex,1];
drAdd[2] = DataGrid1[DataGrid1.CurrentRowIndex,2];
DataSet1.Tables["base"].Rows.Add(drAdd);
先NewRow再Add,可不是两条吗