private void btnUpdateCrypto_Click(object sender, EventArgs e) { bool go = false; Crypto crypto = new Crypto(); foreach (Crypto item in BenCryptoList) { if (txtWalletCode.Text == item.Waletaddress) { BenCryptoList.Remove(item); BenCryptoList.Add(new Crypto(txtWaletName.Text.Trim(), txtWaletName.Text.Trim(), 0, ben.BeneficairyID, "")); CryptoController.UpateCrypto(crypto); FillCryptoDatagrid(BenCryptoList); txtWaletName.Text = ""; txtWalletCode.Text = ""; go = true; break; } } if (go != true) { MetroMessageBox.Show(this, "The Account You're Trying to Update Does Not Exist!", "Account Does Not Exist"); } }