Dim count as Short = 10
Dim roll(count), absent(count), present(count) As Short
Dim i As Short = 1
query = "SELECT * FROM primary_student_table WHERE admityear=" & year & " AND batch= " & batch & ""
con.Open()
cmd = New SqlCommand(query, con)
re = cmd.ExecuteReader
While re.Read
roll(i) = re("roll")
i += 1
End While
con.Close()
absent = txtlist.Text.Split(","c).Select(Function(s) Short.Parse(s)).ToArray()
present = roll.Except(absent).ToArray()
MsgBox(absent(0))
MsgBox(present(0))
In the above code, the values in the arrays are as follows
roll=21,22,23,24,25,26,27,28,29,30 (rollNos of all the students in the class)
txtlist.text value = 21,22 (meaning those two were absent for the class)
Now I need to save the absentees rolls in the array absent and the rest of the rolls in array present
The absentees list gets saved correctly but the second MsgBox is displaying 0 instead of 23
What's wrong with the code