当前位置:编程学习 > C#/ASP.NET >>

怎样把dataGridView中的N行0列传给一个数组,然后在别的窗体调用给数组?

怎样把dataGridView中的N行0列传给一个数组,然后在别的窗体调用给数组?

dataGridView的行数是不固定的. --------------------编程问答-------------------- 你的意思就是:取DataGridView的N行0列的值嘛
================================================
比喻取当前行: 

bindingsource.datasource=datatable;
dataGridView.dataSource=bindingsource;
datarow currentRow=this.datatable.rows[this.bindingsource.position];
messagebox.show(currentrow[0].tostring());

currentRow[0]就是你要取的值,然后传给一个数组那就简单了嘛 --------------------编程问答-------------------- TO:YUAN168(风平浪静真好......) 
不是当前行,是遍历整个gird,取出所有的CELL[0].VALUE,然后付给数组,在别的窗体调用改数组,然后判断改数据的数据和窗体的数据有没有重复的.

for(int i=0;i<dataGridView.rows.count;++i)
{
 arr[i]=dataGridView.rows[i].cell[0].value;
}
行吗?
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,