vb: how to use messsage box, yes, no msgbox?
This site provides users with the information about vb, visual basic, vb6, message box, yes, no message box, how to use msgbox, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use messsage box, yes, no msgbox in vb?
Let's first look at its syntax as follows:
MsgBox(prompt[, buttons] [, title] [, helpfile,
Prompt: text of the message box
buttons: vbCritical, vbQuestion, vbExclamation, and vbInformation.
title: title of the message box
helpfile: These arguments are only applicable when a Help file has been set up to work with the application. It is optional.
The following is the code for using messsage box, yes, no msgbox in vb:
1. Basic message box / msgbox
2. Yes or no message box / msgbox
MsgBox "Please enter your name first.", _
vbExclamation + vbOKOnly, _
Dim iResponse As Integer
iResponse = MsgBox("Are you sure that you want to delete all the records?", _
vbYesNo + vbQuestion, _
If iResponse = vbYes Then
Msgbox "All the records have been deleted!"
Msgbox "All the records have not been deleted!"