coz your "result" is never store any data!!
TRY:
result = MsgBox("Are you sure you wish to quit the application?", MsgBoxStyle.YesNo)
. . .
OR
If MsgBox("Are you sure you wish to quit the application?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
End
End If
*p/s: MSDN will help