Paul Edward Pagente Paul Edward Pagente - 1 month ago 11
Vb.net Question

YES and NO in msgbox always NO is the default

I have a code in VB.Net that looks like this

Dim x as string = Msgbox("Are you sure you want to post this transaction?",vbYesNo)


It works fine but my problem here is instead of
Yes
would be the starting selection how can make it
No
? i mean when the msgbox shows the the highlighted or selected is
No


is it possible? and How?

TYSM

Answer

According here:

MsgBox("Hi!", MsgBoxStyle.DefaultButton2 + MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Hi!!")

Also, that is not how you retrieve a result of a MsgBox:

You can try:

  If MsgBox("Hi!", MsgBoxStyle.DefaultButton2 + MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Hi!!") = MsgBoxResult.No Then
       'Your code
  End If
Comments