0
I’m trying to find the number that the person wrote in the box, in Document.getElementByID on the site, but I can’t do in c#, or tried at least:
private void btnvalidar_Click(object sender, EventArgs e)
{
if (webrequestNumero.Document.GetElementById("Numero").InnerText.IndexOf(txtNumero.Text) == -1)
{
MessageBox.Show("O número está na lista");
}
else
{
MessageBox.Show("O número não está na lista");
}
}
Could someone explain what’s wrong with the code?
Should change to
!= -1
instead of== 1
– Sam
Just complementing what @dvd mentioned, see how the
IndexOf
: https://msdn.microsoft.com/pt-br/library/k8b1470s(v=vs.110). aspx– Ricardo Pontual