Internal Functions Functions Functions are kind of procedures













![Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos] Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos]](https://slidetodoc.com/presentation_image_h2/8f4a7876a39b84c5498b4f703b5a87e7/image-14.jpg)
![Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos] Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos]](https://slidetodoc.com/presentation_image_h2/8f4a7876a39b84c5498b4f703b5a87e7/image-15.jpg)
- Slides: 15
Internal Functions
Functions �Functions are kind of procedures, not like subroutine procedures. �They always send back or return a value. Arguments Manipulate/ Calculate Functions One Output Value
Loadpicture(arguments) �Loadpicture(“path of file”) �Loadpicture(“c: abcimage. jpeg)
WAP �Make a program which will use the image control and show the image in the box when the user click on the button. �Make another program that will show the picture when the form is invoked
Msg. Box() �Msg. Box() is a function that produces a pop-up message box
Format �The following is the format of the Msg. Box() function: � int. Response = Msg. Box(str. Prompt, [ int. Style], [ str. Title]) �int. Response holds the function's integer return data type. �All Msg. Box() functions display a message with at least one command button
�Use integer values to determine the buttons inside message boxes. �Value � 0 � 1 � 2 � 3 � 4 � 5 buttons Named Constant vb. OKOnly vb. OKCancel vb. Abort. Retry. Ignore vb. Yes. No. Cancel vb. Yes. No vb. Retry. Cancel Description OK button OK and Cancel buttons Abort, Retry, and Cancel buttons Yes, No, and Cancel buttons Yes and No buttons Retry and Cancel
�int. Response = Msg. Box("Ready to print? ", 1) �int. Response = Msg. Box("Ready to print? ", vb. OK)
Default Buttons � Value � 0 � 256 � 512 Named Constant vb. Default. Button 1 vb. Default. Button 2 vb. Default. Button 3 Description First button is default Second button is default Third button is default � int. Response = Msg. Box("Is the printer on? ", vb. Yes. No. Cancel + � vb. Default. Button 1 , “Click the button”)
Specifying the Icon
Return Values �Value � 1 � 2 � 3 � 4 � 5 � 6 � 7 Named Constant vb. OK vb. Cancel vb. Abort vb. Retry vb. Ignore vb. Yes vb. No Description The user clicked OK The user clicked Cancel The user clicked Abort The user clicked Retry The user clicked Ignore The user clicked Yes The user clicked No
WAP �Make a program which should tell us that which button has user pressed.
Inputbox()
Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos] [, int. Ypos]) �str. Prompt —The message, such as the question you ask, that appears in the input box. Str. Prompt can be as long as 1, 024 characters. Always phrase the prompt as a question so the user will know how to respond to the input box. �str. Title —The text that appears in the input box window's title bar. In the absence of a title, Visual Basic uses the project name.
Syntax �str. Answer = Input. Box(str. Prompt[, str. Title][, str. Default] [, int. Xpos] [, int. Ypos]) �str. Default —A default value that appears in the input box's input field. Your user can accept your default answer, which is returned when the user closes the message box, change the answer, or type a completely new answer. Use default answers for predictable answers to which the user generally only has to press OK to accept. � • int. Xpos, int. Ypos —The twip coordinate where you want the input box to appear in the form window. You might want to position the input box out of the way of another form or dialog box you've displayed if the input box is asking a question about the other window. If you don't specify twip coordinates, Visual Basic places the input box in the center of the screen.