int index = dataGridView_main.CurrentRow.Index; //取得选中行的索引 int pe_batch_id = Convert.ToInt32(dataGridView_main.Rows[index].Cells["pe_batch_id"].Value); //获取单元格列名为‘pe_batch_id’的值