2
I have a Form
registration in which you have some fields TextBox
and ComboBox
, I want my code to allow the user to register only when all fields are filled, but it is only validating TextBox
, thus allowing the registration without selecting an option in the ComboBox
. Follows the code:
private void btnCadastrar_Click(object sender, EventArgs e)
{
if (txtSerie.Text == string.Empty)
{
MessageBox.Show("Por favor, selecione uma série!", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Warning);
txtSerie.BackColor = Color.Red;
}
else
{
MessageBox.Show("O CADASTRO FOI REALIZADO COM SUCESSO!", "Novo", MessageBoxButtons.OK, MessageBoxIcon.Information);
LimpaTela();
}
}
Thank you very much, it worked! :)
– Alicia Tairini