Datagrid中CheckedBox选择问题 private void viewDataGrid(ref DataGridView dgv, ArrayList importArrayList) { //定义数据源 DataTable dt = new DataTable(); //定义数据显示列 DataColumn idCol = new DataColumn("id", typeof(int)); idCol.ReadOnly = true; DataColumn ExamItemId = new DataColumn("考试项目编号", typeof(int)); ExamItemId.ReadOnly = true; DataColumn carType = new DataColumn("车型", typeof(string)); carType.ReadOnly = true; DataColumn ExamItemName = new DataColumn("考试项目", typeof(string)); ExamItemName.ReadOnly = true; DataColumn itemCheck = new DataColumn("选择栏", typeof(Boolean)); itemCheck.DataType = System.Type.GetType("System.Boolean"); itemCheck.DefaultValue = true; itemCheck.ReadOnly = false; //添加数据列 dt.Columns.Add(itemCheck); dt.Columns.Add(ExamItemName); dt.Columns.Add(carType); dt.Columns.Add(ExamItemId); dt.Columns.Add(idCol); //添加数据 for (int i = 0; i < importArrayList.Count; i++) { DataRow newrow = dt.NewRow(); newrow["id"] = ((ExamingRule)(importArrayList[i])).Id; newrow["考试项目编号"] = ((ExamingRule)(importArrayList[i])).ExamItemId; newrow["车型"] = ((ExamingRule)(importArrayList[i])).CarType; newrow["考试项目"] = ((ExamingRule)(importArrayList[i])).ExamItemName; newrow["选择栏"] = Convert.ToBoolean(((ExamingRule)(importArrayList[i])).ItemChecked); //想DataTable中添加数据 dt.Rows.Add(newrow); } //添加进数据源 dgv.DataSource = dt; }