如何将一个DataGrid中选种的内容在另一个DataGrid中显示
我只能利用dataGrid_CurrentCellChanged方法获取DataGrid1中被单击的行
int row = this.dataGrid1.CurrentCell.RowNumber;
但是接下去,怎么将此行加到DataGrid2中呢???????????
我只能利用dataGrid_CurrentCellChanged方法获取DataGrid1中被单击的行
int row = this.dataGrid1.CurrentCell.RowNumber;
但是接下去,怎么将此行加到DataGrid2中呢???????????
{
string stx1=this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString();string sql="select * from 表 where 字段名称='"+stx1+"'"
......
...
..
dataGrid2.DataSource=cmd.ExecuteNonQuery();
}
但是如果选择多行的话,还是不好处理啊
其实最好是利用add方法,选择一个加一个
个人感觉这样最好,但是该如何实现呢?????????
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemwindowsformsdatagridcolumnstyleclassgetcolumnvalueatrowtopic.asp