You're probably referring to these lines
MsgBox("Delete Record?", MsgBoxStyle.YesNo)
If MsgBoxResult.Yes Then
The problem is that you don't store the result of the messagebox
Try for example like this
If MsgBoxResult.Yes = MsgBox("Delete Record?", MsgBoxStyle.YesNo)Then
or if you want to use a variable then perhaps
Dim result
result = MsgBox("Delete Record?", MsgBoxStyle.YesNo)
If MsgBoxResult.Yes Then