Reputation: 99
Is it possible to set it so there is no default button focus when a messagebox appears? This way, the message box will force the user to select Yes or No with a mouse. The MessageBoxDefaultButton (as seen below) only allows for the changing of the default button and does not give the option to select none.
MsgBox("continue?", vbYesNo + vbQuestion, "Do you want to continue?", MessageBoxDefaultButton.Button1)
Thanks!
Upvotes: 1
Views: 6122
Reputation: 1
Visual Studio (VB, 16.8.4) - If you need the Information symbol together with focus on the Yes button try this:-
MsgBox("Your message", vbQuestion + vbYesNo + MsgBoxStyle.DefaultButton1, "The MsgBox title")
Upvotes: 0
Reputation: 1073
Its quiet easy to set default button on Vb.net Msgbox by combining MsgBoxStyle (MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2) :
MsgBox("Er. Mayank Nainwal", MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2, "Default Button is NO ?")
If MsgBox("Er. Mayank Nainwal", MsgBoxStyle.YesNoCancel + MsgBoxStyle.DefaultButton2, "Default Button is NO ?") = MsgBoxResult.Yes Then
'' Your Code
End If
Upvotes: 3