Hi,
you need to publish
ValidStudent(TBRNo.Text);
funtion instead of others.
for a help can you check your array index is negative or less than expected.
array.length=5;
if index < array.length
return array[index]
like that. i think you need to fix it inside the ValidStudent(TBRNo.Text);
or when you assign the return to the bool. Just check it and you get fix.
good luck.