Rishabh Rishabh - 6 months ago 19
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.

Answer

You need to check whether MsgBox returned vbYes.

For example:

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