if(stringName.charAt(0) != 'Q' || stringName.charAt(0) != 'W' || stringName.charAt(0) != 'E'){
SetID = "Yes";
}
The above code when I use alert to popup the windows the value of My.String.charAt(0) is returning the correct value but I don’t know why it goes inside the if statement and change the value of SetID to Yes
I’m trying to figure out what is wrong with it and really can’t see anything
SetID is initialize to No
You’re using
||but you probably mean&&…The way it is now, it’ll always be
true. “If the character is not ‘Q’, or it’s not ‘W’, or it’s not ‘E’, then …” — even if it is one of those characters, it will not be the others, so the expression evaluates totrue.