8
I’m doing a little program that searches inside a vector. The problem I’m having is that if he finds the name he gives a message saying it was found but then gives another message saying that it was not found, the code I’m creating is this:
string[] nomes = { "misael", "camila", "fernando" };
for (int i = 0; i < nomes.Length; i++) {
if (txtbusca.Text == nomes[i])
{
MessageBox.Show("nome encontrado");
}
}
for (int i = 0; i < nomes.Length; i++) {
if (txtbusca.Text != nomes[i])
{
MessageBox.Show("nome não encontrado");
}
}
If any of the answers helped you mark it as correct so that future visitors have a reference.
– fernandosavio
And I’m new here, I don’t know how you do it
– Rebeca Aguirrer
Just click on the symbol of checked
✔
http://imgur.com/a/sJi2a– fernandosavio