I have the following code that is suppose to search an array :
for (int i = 0; i < this.passwordList.Length; i++)
{
string userInput = Convert.ToString(this.passInput);
if(userInput == passwordList[i])
{
MessageBox.Show("FOUND");
foundResult = 1;
break;
}
//MessageBox.Show();
}
and the array has the following results :
public string[] passwordList = {"123456", "145784" , "asasas"};
What am I doing wrong!?!?
The mistake is probably here:
If you have a WinForms control, try something like this instead:
You might also want to inspect the value of
userInputin a debugger to make sure that it contains the value that you expect.