Try this:
Dim AllPlayerInfo As String()
AllPlayerInfo = PlayerFile.Split(vbCrLf.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
If Not AllPlayerInfo.Length = 0 AndAlso AllPlayerInfo(1).ToLower() = TextBox1.Text.ToLower() AndAlso AllPlayerInfo(2).ToLower() = TextBox2.Text.ToLower() Then
MsgBox("Hello " & TextBox1.Text)
Return True
Else
MsgBox("Can't Find This Account .. ", MsgBoxStyle.Information)
Return False
End If
Your messagebox always displays becuase you have written it outside the scope of IF..THEN..ELSE statement. By doing this it will display iff the "Length" property returns zero, which is your intentions i guess.
Hope it helps!
EDIT
First of all, the code has been modified. I have figured out a couple of things is your code.
1) No need to EXIT FUNCTION when there is already RETURN statement present. So remove it.
2) Change:
PlayerFile.Split(vbCrLf)
to :
PlayerFile.Split(vbCrLf.ToCharArray, StringSplitOptions.RemoveEmptyEntries)
my guess is that you are getting a "vbLf" appended in front of the next array element which fails the comparison. So doing it this way will fix this issue.
3) When we compare strings it is preferred to make it either UPPER case or LOWER case, so i have used
.ToLower(), depending upon case sensitivity. Please adjust it as per your scenario.
4) It is good to define ELSE part for each IF..ELSE IF condition, it helps to cover the rest of the cases so instead of defining three ELSE statements i have minimized the condition to one IF..ELSE statement.
Check it out. Hope it helps!
If you need further assistance please come up with sample values of variables and the desired result examples.
Happy coding!!!