Answered by:
How do I show a confirmation box instead of a MessageBox?

Question
-
I am trying to find a relatively simple way of showing a MessageBox with a "Yes" and "No"(Confirmation box). Can anyone help me please?Tuesday, September 5, 2006 6:45 AM
Answers
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As DialogResult
answer = MessageBox.Show("Was nobugz here?", "Yes/no sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If answer = vbYes Then
Debug.Print("He waz")
End If
End SubTuesday, September 5, 2006 7:29 AMModerator
All replies
-
Create your own dialog form and place the "Yes" and "No" button there and set the DialogResult property of the button accordingly. and use this form to work as a message box. and show it calling the ShowDialog Method.Tuesday, September 5, 2006 6:51 AM
-
This is how i do it
MsgBox("Message To Display", MsgBoxStyle.YesNo, "Title")
if you can go
if MsgBox("Message To Display", MsgBoxStyle.YesNo, "Title") = MsgBoxResult.Yes then
.
.
.
End if
HTH
AndrewTuesday, September 5, 2006 6:56 AM -
MsgBox is the VB6 way of showing the messagebox. But in vb.net it is replaced with MessageBox. So If You are working in VB.Net then use it's provided method. But there is no problem in using MsgBox because it is still supproted by .net.Tuesday, September 5, 2006 7:05 AM
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim answer As DialogResult
answer = MessageBox.Show("Was nobugz here?", "Yes/no sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If answer = vbYes Then
Debug.Print("He waz")
End If
End SubTuesday, September 5, 2006 7:29 AMModerator -
Thanks nobugz.Tuesday, September 5, 2006 7:47 AM