Download presentation
Presentation is loading. Please wait.
Published byCharles Cain Modified over 9 years ago
2
Class 3 Remote Instruction Computer Math EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is turned up, and press F5 to begin. Click to advance as usual.
3
Quick Review of Variables Declare a variable: – Dim variable_name As Type Popular types: – String: Text. – Integer: Whole number. – Single: Decimal number. – Boolean: True/false. Can declare in 3 places: – Within a button (event procedure). – On the form. – In a module. Will be “alive” for entire program.
4
Review of Working with Controls To gather input from a textbox: – variable_name = txtInput.text To output information to a label: – lblOutput.text = variable_name To change a control’s properties: – lblOutput.visible = True – lblOutput.text = "Here is the text to appear." – txtInput.text = "" Concatenation: – variable_name = "My age is " & age & "." Clears all the text from the control.
5
Review of Text Boxes Don’t forget that you may want to change the “autosize” property of a text box in order to be able to resize it.
6
Introducing Some New Controls
7
Working with Graphics 1.Double-click the picturebox control. 2.Press the little arrow in the upper right of the box, and select “choose image.” 3.Press “import” under local resource. Choose your image.
8
Hiding/Displaying Graphics PictureBox1.visible = True PictureBox1.visible = False
9
Numeric Up/Down Control Set minimum and maximum properties. Allows user to set a number. Different way to gain user input.
10
Combo Box Control Press little arrow on the combobox to add a menu of items from which users can select. Different way to gather user input.
11
Introduction to Computer Math
12
Intro. to Computer Math Dim num1, num2, answer As Integer num1 = 2 num2 = 2 answer = num1 + num2 answer = num1 – num2 answer = num1 * num2 answer = num1 / num2 Declare variables. Store numbers in variables. Now you can do math, using the numbers stored in the variables.
13
Input and Output Math First, declare the variables you will need: – Dim num1, num2, answer As Integer Then, gather student numbers from textboxes: – num1 = txtInputNum1.text – num2 = txtInputNum2.text Now you are ready to do the math: – answer = num1 + num2 Finally, output the answer in a label: – lblOutput.text = answer
14
Put It All Together Enter 2 numbers: Answer Dim num1, num2, answer As Integer num1 = txtInputNum1.text num2 = txtInputNum2.text answer = num1 + num2 lblOutput.text = answer lblOutput txtInputNum2 txtInputNum1
15
Using a Counter Variable counter = counter + 1 lblOutput.text = counter Form Form1 Dim counter As Integer lblOutput
16
Remote Assignment Please enter 2 numbers: Answer
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.