private void btnAdd2Pt_Click(object sender, EventArgs e) { bool found = ConnectDataBases.SearchForUser(txtbxSearch.Text); bool copy = false; if (found) { for (int i = 0; i < dbListPartyList.Rows.Count; i++) { Console.WriteLine("\nPARTY MAKER FORM: i : " + i); if (dbListPartyList.Rows.Count > 0) { Console.WriteLine("\nPARTY MAKER FORM: " + dbListPartyList.Rows[i].Cells[0].Value.ToString()); if (dbListPartyList.Rows[i].Cells[0].Value.ToString() == txtbxSearch.Text) { copy = true; } else { copy = false; } } else { copy = false; } } if (copy) { MessageBox.Show("A person can only join once!"); } else { rowIndex = dbListPartyList.Rows.Add(); dbListPartyList.Rows[rowIndex].Cells[0].Value = ConnectVariables.GetUsernameDP(); dbListPartyList.Rows[rowIndex].Cells[1].Value = ConnectVariables.GetUserIDDP(); } } }