private void btnUpdateCategory_Click(object sender, EventArgs e) { if (dgvCategoryInfo.SelectedRows.Count > 0) { var id = Convert.ToInt32(dgvCategoryInfo.SelectedRows[0].Cells[0].Value); mea.Obj = catBLL.GetCategoryInfoByID(id); LoadFrmChangeCategoryInfo(2);//修改 } else { MessageBox.Show("未选中需要修改的行"); } }