Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box - YesNo with a Question

Status
Not open for further replies.

mojoT

Technical User
Sep 23, 2003
25
0
0
NZ
Hiya All

I want to have a YesNo msgbox in my Windows application, but with a Question Mark icon. So far I've tried:

MsgBox("Message", MsgBoxStyle.YesNo.Question, "Title") and
MsgBox("Message", MsgBoxStyle.Question.YesNo, "Title")

The first one Shows the question mark, but replaces the Yes and No buttons with an OK button, and the second one shows the Yes and No buttons, but no question mark.

It is possible, cos I've seen it in Windows many times before, so if anyone can help out, I'll be really grateful.
 
Where you have the buttons a value of 32 gives you the question mark. If you want two sets of buttons vbYesNo = 4 and vbQuestion = 32 you add them

so Buttons:=36

(at least in VBA anyway)

dyarwood
 
Another way is to use the + symbol

MsgBox("Message", vbYesNo + vbQuestion, "Title")

(again in VBA)
 
Mojo,

Dim message As String = "Are you sure you want to permanently delete the selected record?"
Dim caption As String = "Confirm delete"
Dim buttons As Integer = MessageBoxButtons.YesNo
Dim result As DialogResult
result = MessageBox.Show(Me, message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
If result = DialogResult.Yes Then
[ ... ]
End If

Lazer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top