我在我的 c# windows 应用程序中有以下代码,我试图在其中插入与每一行对应的复选框。当我单击所选行之外的按钮时,应删除。但我无法使用此代码选择复选框。
dataGridView1.ReadOnly = false;
OleDbCommand SQLQuery = new OleDbCommand();
DataTable data = null;
dataGridView1.DataSource = null;
SQLQuery.Connection = null;
OleDbDataAdapter dataAdapter = null;
dataGridView1.Columns.Clear();
SQLQuery.CommandText = sqlQueryString;
SQLQuery.Connection = database;
data = new DataTable();
dataAdapter = new OleDbDataAdapter(SQLQuery);
dataAdapter.Fill(data);
dataGridView1.DataSource = data;
dataGridView1.AllowUserToAddRows = true; // remove the null line
dataGridView1.ReadOnly = true;
dataGridView1.Columns[0].Visible = true;
dataGridView1.Columns[1].Width = 340;
dataGridView1.Columns[2].Width = 55;
// insert checkbox button into datagridview
deleteck = new DataGridViewCheckBoxColumn();
deleteck.HeaderText = "delete";
deleteck.Width = 80;
deleteck.ReadOnly = false;
dataGridView1.Columns.Insert(0, deleteck);
谁能帮我弄清楚这里出了什么问题?