#region 加入checkBox /// <summary> /// 加入checkBox /// </summary> /// <param name="datagridview"></param> private void chekBox(DataGridView datagridview) { DataGridViewCheckBoxColumn newColumn = new DataGridViewCheckBoxColumn();//添加CHECKBOX newColumn.HeaderText = "选择"; datagridview.Columns.Insert(0, newColumn); datagridview.MultiSelect = true; newColumn.InheritedStyle.Alignment = DataGridViewContentAlignment.TopCenter; newColumn.Width = 35; datagridview.VirtualMode = false; } #endregion //dataGrvieCheckBox是否全选 private void dataGrviesCheckBoxIsFT(CheckBox checkbox, DataGridView datagridview) { if (checkbox.Checked == true) { if (datagridview.Rows.Count > 0) { for (int i = 0; i < datagridview.Rows.Count; i++) { ((DataGridViewCheckBoxCell)datagridview.Rows[i].Cells[0]).Value = true; } } } else { if (datagridview.Rows.Count > 0) { for (int i = 0; i < datagridview.Rows.Count; i++) { ((DataGridViewCheckBoxCell)datagridview.Rows[i].Cells[0]).Value = false; } } } } //选中删除的记录 private void button15_Click(object sender, EventArgs e) { if (dataFssb.Rows.Count > 0) { for (int i = 0; i < dataFssb.Rows.Count; i++) { string _selectValue = dataFssb.Rows[i].Cells[0].EditedFormattedValue.ToString(); if (_selectValue == "True") { //MessageBox.Show(dataGridView2.Rows[i].Cells["fsmx_no"].Value.ToString()); sqlhelpers.ExecuteNonQuery("delete from dxpt_Fsmx where fsmx_no=" + dataFssb.Rows[i].Cells["fsmx_no1"].Value.ToString() + ""); } } } this.dataFssb.DataSource = sqlhelpers.datatable("select rwlb,wczt,zdsjhm,fsnr,cjsj,cgsj,fsmx_no from dxpt_fsmx where wczt='发送失败'"); }