An experienced programmer would use an API and here is how it's done.

Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const LB_FINDSTRINGEXACT = &H1A2
Private Sub cmdAddRecord_Click()
    
If (SendMessage(lstNames.hwnd, LB_FINDSTRINGEXACT, -1&, _
                        ByVal CStr(txtStudentNames.Text))) > -1& Then
    MsgBox "Name is already in the list"
Else
    ' Add the names to the list
End If

End Sub
However I suggest you instead just loop through the list and if you find a match for txtStudentNames.Text then display the error message. I'm purposely not showing you how to do this because I think you should be able to do it by yourself.