Knowing more about MsgBox and its functions

Asked By 60 points N/A Posted on -
qa-featured

Hi!

I would like to know more about MsgBox functions in VB2015. Can you please describe and enumerate the named literal for MsgBox buttons that I can use? What are the values I can use and describe it to me fairly? What are the message box icons I can use to notify the program user about the actions requested? Can you provide me a sample message box implementation and explain to me how it works? Why do we have to use the “+” sign every time in programming?

Please help me thank you!

SHARE
Answered By 0 points N/A #174666

Knowing more about MsgBox and its functions

qa-featured

Hello Mellisa!

Here are the Named Literal for MsgBox in VB

1.  VbCritical – displays critical message and icon.

2.  VbQuestion – displays warning query icon.

3.  VbExclamation – displays warning messages icon.

4.  VbInformation – displays information messages icon.

You just need a form to create this program. The sample output windows is shown below.

 

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim uname, mess1 As String

        uname = InputBox("Enter your name:", "Log-in Name")

        mess1 = MsgBox("Your login name is " & uname, vbInformation + vbOKOnly, "Log-in name result")

    End Sub

End Class

Explanation: In line number 3 we declared uname and mess1 as String. Meaning to say it will accept any characters and consider it as a string. Line 4 initiated us to enter any name. Line 5 will display the value of uname that we entred at line 4 and post the name we entered.

Related Questions