Rishabh Rishabh - 11 months ago 43
Vb.net Question

How do I take the result from a message box?

In Visual Basic in Visual Studio 2010, if this is used for giving a message,

MsgBox("hello", 4, "status")

how do I manipulate the result Yes or No from the msgbox?

Like this should happen if the user gives No and this should happen if No.


You need to check whether MsgBox returned vbYes.

For example:

If vbYes = MsgBox("hello", vbYesNo, "status") Then
    'Do things
    'Don't do things
End If