I was actually working an Attendance System, using listbox i want to monitor whether "employees" timed in or out. txtEmpNum.text as my textbox, rdTin as my radio button for time in, rdTout as my radio button for time out, lblName, lblDept, lblinout are just label. I want that if a user already timed in his/her name wont appear on my listbox rather msgbox pop up. But on this code although msgbox poped up, still the name of the employee appears on my listbox.
If txtEmpNum.Text = 8888 Then
If rdTin.Checked = True Then
For i As Integer = 0 To listEmp.Items.Count - 1
If (listEmp.Items(i).ToString.Contains("Bane Lim")) Then
MsgBox("String found at " & (i + 1).ToString)
Exit For
End If
Next
lblName.Text = "Bane"
lblDept.Text = "Admin"
lblinout.Text = "In"
listEmp.Items.Add("Bane Lim")
txtEmpNum.Clear()
ElseIf rdTout.Checked = True Then
lblName.Text = "Bane"
lblDept.Text = "Admin"
lblinout.Text = "Out"
listEmp.Items.Remove("Bane Lim")
txtEmpNum.Clear()
End If