private void button2_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridView2.Rows) { if (row.Cells[0].Value.ToString() == dataGridView1.SelectedRows[0].Cells[0].Value.ToString()) { //game already on wishlist return; } } SQLManager.InsertWish(loggedUser, dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); UpdateWishlist(); }