private void btnCad_Click(object sender, EventArgs e) { if (ttbLogin.Text == "") ttbLogin.BackColor = Color.Red; if (ttbSenha.Text == "") ttbSenha.BackColor = Color.Red; if (ttbConfirmaSenha.Text == "") ttbConfirmaSenha.BackColor = Color.Red; if (ttbLogin.Text != "" && ttbSenha.Text != "" && ttbConfirmaSenha.Text != "") { if (ttbSenha.Text != ttbConfirmaSenha.Text) { ttbSenha.BackColor = Color.Green; ttbConfirmaSenha.BackColor = Color.Beige; } else { user = new Usuario(ttbLogin.Text, ttbSenha.Text); if (user.criarNovo()) { cadastroRealizado = true; user.Id = user.getUltimoId(); btnCad.Enabled = false; btnPerm.Enabled = true; ttbLogin.Enabled = false; ttbSenha.Enabled = false; ttbConfirmaSenha.Enabled = false; } else MessageBox.Show("Ocorreu um problema no cadastro!", "Não realizado", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }