' Basic Programming ' Ch. 8 Demo Program #4 ' by Mr. Minich ' Purpose - to demonstrate passing parameters
Option Explicit Private Sub txtUserInput_Change() ' Since the Change event for the text box is being used, ' this procedure executes with every key that the user ' presses. ' Precondition: a numeric value will be entered into the text box ' Postcondition: 2 will be added to the value and that result will be ' multiplied by 3; then the value will be displayed ' Calls: AddTwo ' Called by: none Dim UserInput As Integer ' user's inputted numeric value UserInput = Val(txtUserInput.Text) Call AddTwo(UserInput) End Sub Private Sub AddTwo(Incoming As Integer) ' Calls: MultiplyBy3 ' Called by: txtUserInput_Change Incoming = Incoming + 2 Call MultiplyBy3(Incoming) End Sub Private Sub MultiplyBy3(AnyNumber As Integer) ' Calls: DisplayIt ' Called by: AddTwo AnyNumber = AnyNumber * 3 Call DisplayIt(AnyNumber) End Sub Private Sub DisplayIt(Whatever As Integer) 'Calls: none 'Called by: MultiplyBy3 lblFinalValue.Caption = Whatever End Sub