Presentation is loading. Please wait.

Presentation is loading. Please wait.

Section 3.5 - Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes.

Similar presentations


Presentation on theme: "Section 3.5 - Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes."— Presentation transcript:

1 Section 3.5 - Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes

2 Input Boxes (Section 3.5) zAn input box is an object that appears on the form solely for the purpose of receiving data to the program. Once the data is entered by the user, the box disappears. zstr_var = InputBox(prompt,title) Variable to receive input data Identifies the object Instruction to user Caption

3 Private Sub Command1_Click() Dim Char As String, message1 As String Dim message2 As String Dim x As Single Picture1.Cls message1 = "Please enter a character string" message2 = "Please enter a 3-digit number" Char = InputBox(message1,”Character input”) x = Val(InputBox(message2,”Numeric input”)) Picture1.Cls Picture1.Print Char Picture1.Print x * 2 End Sub

4 Notes on Input boxes zWe can use an input box if we want a user to provide input data to a program. The input box appears when an event procedure invokes it and it disappears when the user clicks on OK or presses the Enter key. zThe data entered is character string type. zCompare an input box to a text box

5 Message Boxes zSame idea as input boxes; object appears for the purpose of displaying output and then it disappears from sight. zMsgBox prompt,, title zMsgBox “Better luck next time”,, “Hello” Identifies the object Message to user Caption

6 Formatting Output zVertical - Each PictureBox.Print causes a new line to display; no argument causes a line skip zHorizontal - y; or, print zones (p. 104) yTab(n) - nth position of line (p. 105) ySpc(n) insert n spaces zFormat (pp. 122 - 124)

7 Today’s Lab zPage 116 #49, 51

8 Homework Assignment (HW4) zDue next Tuesday zPage 117 #53. There is no input. Write code to calculate the total. Display the results in a picture box. z Page 117 #54. Make a command button and a picture box. When the button is clicked an input box appears. The user should enter the amount of the bill. Another input box then appears to collect the percentage tip. Display the results in the picture box.


Download ppt "Section 3.5 - Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes."

Similar presentations


Ads by Google