If you are actually using VB.NET, then that won't work because MsgBox will cause a display at teh Server, not the CLient - so the user won't see it. In that case, you probably want to use Javascript to do the comparison, as it doesn't need to leave the browser until the user is happy. See here:
http://keithscode.com/tutorials/javascript/3-a-simple-javascript-password-validator.html[
^]
If you are using VB in a Windows application, your code above should work - so either I don't understand your question, or the problem is elsewhere in your code.