Sunday, September 21, 2008

MessageBoxButtons.YesNo

To interact with user before saving any record or performing a very important operation we can re ask him through dialog result by following the below method.

Dim Buttons As Integer = MessageBoxButtons.YesNo

Dim Result As DialogResult

Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)


If Result = DialogResult.Yes Then
MessageBox.Show("You choosed Yes")
else
MessageBox.Show("You choosed No")
End If

No comments: