I have a Form
of register that has some fields TextBox
and ComboBox
, I want my code to allow the user to register only when all fields are filled, but only validating the TextBox
thus allowing the registration to be carried out without selecting an option in ComboBox
. Here is 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();
}
}