110,538
社区成员
发帖
与我相关
我的任务
分享
String Str1,Str2;
DataGridViewCell c = dataGridView1.SelectedCells;
//通过c.RowIndex去dt取值
str1 = dt(DataTable对象)rows[c.RowIndex]["colname"].ToString();
//如果不是最后一条记录,则继续去下一条
if (c.RowIndex != dataGridView1.Rows.Count-2)
{
str2 = dt(DataTable对象)rows[c.RowIndex+1]["colname"].ToString();
}else
{
MessageBox.Show("已经是最后一条记录了");
}