What is the difference between msgbox and inputbox in vb?
Answers
Answered by
30
InputBox(): The InputBox() function is used to take the input from the user at run time.
The general Syntex is: InputBox(prompt,title,default,xpos, ypos, helpfile, context)
Arguments:
Prompt: The message in the dialog box.
Title: The title-bar of the dialog box.
Default: String to be displayed in the text box on loading.
Xpos: The distance from the left side of the screen to the left side of the dialog.
Ypos: The distance from the top of the screen to the top of the dialog box.
Helpfile: The Help file to use if the user clicks the Help button on the dialog box.
Context: The context number to use within the Help file specified in helpfile.
MsgBox():Displays a dialog box containing a message, buttons, and optional icon to the user. The action taken by the user is returned by the function as an integer value.
Syntax: MsgBox(prompt, buttons, title, helpfile, context)
Arguments:
Prompt: The text of the message to display in the message box dialog.
Buttons: The sum of the Button, Icon, Default Button, and Modality constant values.
Title: The title displayed in the Title-bar of the message box dialog.
Helpfile: An expression specifying the name of the help file to provide help functionality for the dialog.
Context: An expression specifying a context ID within helpfile.
The general Syntex is: InputBox(prompt,title,default,xpos, ypos, helpfile, context)
Arguments:
Prompt: The message in the dialog box.
Title: The title-bar of the dialog box.
Default: String to be displayed in the text box on loading.
Xpos: The distance from the left side of the screen to the left side of the dialog.
Ypos: The distance from the top of the screen to the top of the dialog box.
Helpfile: The Help file to use if the user clicks the Help button on the dialog box.
Context: The context number to use within the Help file specified in helpfile.
MsgBox():Displays a dialog box containing a message, buttons, and optional icon to the user. The action taken by the user is returned by the function as an integer value.
Syntax: MsgBox(prompt, buttons, title, helpfile, context)
Arguments:
Prompt: The text of the message to display in the message box dialog.
Buttons: The sum of the Button, Icon, Default Button, and Modality constant values.
Title: The title displayed in the Title-bar of the message box dialog.
Helpfile: An expression specifying the name of the help file to provide help functionality for the dialog.
Context: An expression specifying a context ID within helpfile.
Answered by
1
Answer: The difference between msgbox and inputbox Visual Basic.
Explanation:
msgbox function
- It is a built-in dialog box that can be used to display a message to the user and wait for a response.
- This function is extremely useful and often very useful when you are debugging.
- This function returns a value that indicates which option the user has selected.
- This function can be inserted anywhere in your code to stop the program and display a message to the user.
inputbox function
- This is a VBA built-in dialog box that can be used to prompt the user for information.
- This type of message box displays a message and waits for a response from the user by pressing a button.
- This function always returns a string, so you often have to convert the value to its correct data type. Even if a numeric value is entered, it will be returned as a string.
InputBox and MsgBox are two useful functions. Each opens a dialog window, which closes when the user responds. InputBox is used to receive input from the user, and MsgBox is used for output.
#SPJ2
Similar questions
Physics,
8 months ago
Social Sciences,
1 year ago