private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; LinkedListNode <QueryElement> node; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { if (e.ColumnIndex == IgnoreButton.DisplayIndex) { int indx = Convert.ToInt32(senderGrid.Rows[e.RowIndex].Cells[index.DisplayIndex].Value.ToString()); for (node = link.Last; node != null; node = node.Previous) { if (indx == node.Value.GetIndex()) { switch (node.Value.GetQType()) { case QueryElement.QueryType.DBError: DBErrors--; break; case QueryElement.QueryType.SysError: SysErrors--; break; case QueryElement.QueryType.ClientError: ClientErrors--; break; case QueryElement.QueryType.Error: break; case QueryElement.QueryType.None: break; case QueryElement.QueryType.ClientWarning: ClientErrors--; break; } node.Value.Dispose(); node.Value = null; link.Remove(node); dataGridView1.Rows.RemoveAt(e.RowIndex); RemoveQueryHandle(); break; } } } else if (e.ColumnIndex == Completebutton.DisplayIndex) { int indx = Convert.ToInt32(senderGrid.Rows[e.RowIndex].Cells[index.DisplayIndex].Value.ToString()); for (node = link.Last; node != null; node = node.Previous) { if (indx == node.Value.GetIndex()) { if (node.Value.GetQType() == QueryElement.QueryType.DBError) { if (!String.IsNullOrEmpty(node.Value.GetQuery())) { MySQLCon DB = new MySQLCon(); DB.SendQuery(node.Value.GetQuery()); node.Value.Dispose(); node.Value = null; link.Remove(node); dataGridView1.Rows.RemoveAt(e.RowIndex); DBErrors--; RemoveQueryHandle(); break; } } else if (node.Value.GetQType() == QueryElement.QueryType.SysError) { } else if (node.Value.GetQType() == QueryElement.QueryType.ClientError) { } else if (node.Value.GetQType() == QueryElement.QueryType.ClientWarning) { if (!String.IsNullOrEmpty(node.Value.GetQuery())) { MySQLCon DB = new MySQLCon(); DB.SendQuery(node.Value.GetQuery()); node.Value.Dispose(); node.Value = null; link.Remove(node); dataGridView1.Rows.RemoveAt(e.RowIndex); ClientErrors--; RemoveQueryHandle(); break; } } } } } } }