Lectures 7,8,9,10 - Assignment3Lectures

Lectures 7,8,9,10 - Assignment3Lectures - Assignment 3...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style 3/17/10 Assignment 3 Lectures February 1 to 10, 2010 11
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 If Then Useful computer programs typically have to make a lot of decisions. In VB, If…Then code is used for decision making. 22
Background image of page 2
3/17/10 Select Case 33 When you want to choose among several options based on the value of an expression, you can use Select Case. The full code for these examples can be found in Conditionals.zip, available in Lecture materials.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 Select Case Here’s another Select Case example. Note that it uses the colon (“:”) to combine two lines of code into one. This example is demonstrated in the video (see slide 29) 44
Background image of page 4
3/17/10 Another Select Case This example demonstrates several different Case formats that can be used: 55
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 Enumerations Enumerations are the VB equivalent to lookup tables. They allow you to define datatypes with a limited number of named choices. 66
Background image of page 6
3/17/10 Loops This slide and the next one demonstrate several types of loops available in VB. The comments explain what is happening. 77
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 Other Loop Formats 88
Background image of page 8
3/17/10 Procedures Before OOP, subroutines were the primary high-level way to organize a program. In OOP, this role has been taken over by the Class. Nevertheless, at some point the organization stops and the work begins. The work in any program is done by the procedures. 99
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 Subs and Functions Visual Basic uses two types of procedures: Subroutines (Subs) and Functions. We could add properties as well, but a property is simply one sub and one function operating under the same name. The words “procedure” and “method” both mean a Sub or a function. 1010
Background image of page 10
3/17/10 Sub or Function? As far as VB is concerned, the only difference between a Sub and a Function is that a Function returns a value, but a Sub does not. However, good programming (as required in this course) demands a stricter distinction: A Function is the calculator: it performs only one role—returning a value (usually based on the input parameters). It should perform no other tasks that cause changes in the working of the program. 1111
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3/17/10 Parameters Both subs and functions can take parameters, also known as arguments. In the sub below, the graphics object “g” is the only parameter. Parameters are by default ByVal (by value); VB will fill this in for you if you don’t type it. The other way of declaring a 1212
Background image of page 12
Parameters Subs and functions can take multiple parameters of different types. Multiple parameters should be separated by commas. The parameters work just like local variables in the sub; whatever value is passed to a parameter is used wherever that parameter’s name is used in the procedure. 1313
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/17/2010 for the course IOE 373 taught by Professor Bobgoodsell during the Winter '10 term at University of Michigan-Dearborn.

Page1 / 132

Lectures 7,8,9,10 - Assignment3Lectures - Assignment 3...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online