1

Even finding the desired value in the register vector displays the message "TP não encontrado". I need that when the value is found it does not display the message that was not found.

for (int i = 0; i < cadastro_tp.Length; i++)
{
   if (txbTp.Text == cadastro_tp[i].tpv)
   {
      txbCnpj.Text = cadastro_tp[i].cnpjv;
      txbNome.Text = cadastro_tp[i].nomev;
      cboCanal.Text = cadastro_tp[i].canalv;
      txbPortal.Text = cadastro_tp[i].portalv;
      txbEmpresa.Text = cadastro_tp[i].empv;
      txbEmail.Text = cadastro_tp[i].emailv;
      txbTel.Text = cadastro_tp[i].telv;
      break;
   }
}
MessageBox.Show("TP não encontrado");
  • Já usei o else e o if else porém continua executando a mensagem – Ronison Matos Jan 20 '19 at 14:24
0

I was able to solve by replacing the break to return.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.