What are InputBox and MsgBox Functions in VB Script while working with QTP? and What is the difference between InputBox and MsgBox?

InputBox Function:

The InputBox function displays a dialog box containing a label, which prompts the user about the data you expect them to input, a text box for entering the data, an OK button, a Cancel button, and optionally, a Help button. When the user clicks OK, the function returns the contents of the text box.

Syntax: 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 Function:

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.

Related posts:

  1. Working With Step Generator in QTP
  2. Understanding Synchronization Points in QTP
  3. Data Table Locations in QTP
  4. Test Directory Structure in QTP