Mis 15 Midterm
Mis 15 Midterm
Mis 15 Midterm
(Gianna also found it on Quizlet!!! Some of the answers are slightly different but still
good!)
What is an object?
An object is an item contains data and has the ability to perform operations.
What is a method?
A method is the operation that an object can perform
What is a class?
A program structure that defines a data type.
Case structure
Select Case control structure is slightly different from the If.ElseIf control structure . The difference is that
the Select Case control structure basically only make decision on one expression or dimension (for example
the examination grade) while the If ElseIf statement control structure may evaluate only one expression,
each If.ElseIf statement may also compute entirely different dimensions. Select Case is preferred when
there exist multiple conditions because using IfThen..ElseIf statements will become too messy.
Nested IF-THEN-ELSE
We need to use nested If...Then... Else statements if a condition is depending on other conditions that have
to be fulfilled first. A nested If statements are enclosed within other If statements.
IF-THEN-ELSE LOGIC
Text property
Assignment operator "="
Assigns value to variables. Can be assigned from raw value to variable or pass values from variable to
variable byVal.
Changing properties in the code
.sln file
Organizes projects, project items and solution items into the solution
Comment
Me.Close()
Closes current application on button press it is assigned to
Prefixes on objects, constants and variables and constants
obj = objects CONST variables = int, dbl, txt, lbl, rbtn, chk, ...
Logic and syntax errors
StretchImage
FormatCurrency
Format currency changes the output of a double or an int to be shown as currency with $ out front and
rounded to 2 decimal places
Checkbox
The Check box is a very useful control in Visual Basic 2010. It allows the user to select one or more items by
checking the check box/check boxes concerned
.
RadioButton
The radio button is also a very useful control in Visual Basic 2010. However, it operates differently from the
check boxes. While the checkboxes work independently and allow the user to select one or more items ,
radio buttons are mutually exclusive, which means the user can only choose one item only out of a number
of choices.
Visible property
Type: System.Boolean
true if the control and all its child controls are displayed; otherwise, false. The default is true.
WithEndWith
By using With...End With, you can perform a series of statements on a specified object without specifying
the name of the object multiple times. Within a With statement block, you can specify a member of the object
starting with a period, as if the With statement object preceded it.
For example, to change multiple properties on a single object, place the property assignment statements
inside the With...End With block, referring to the object only once instead of once for each property
assignment.
If your code accesses the same object in multiple statements, you gain the following benefits by using the
With statement:
You don't need to evaluate a complex expression multiple times or assign the result to a temporary
variable to refer to its members multiple times.
You make your code more readable by eliminating repetitive qualifying expressions.
What is a variable?
When you declare a variable or constant, you are telling the program to reserve a physical location for this
variable or constant in memory and to format that location so that it can hold a certain type of data, such as
decimal, string, integer, etc.
You are also giving the location a name (an identifier) to be used to access its physical location.
Module-level declarations
Variables declared at this level can be used in any sub procedure in Form1.
Local variables
A local variable is one that is declared within a procedure. a local variable in a procedure ceases to exist as
soon as the procedure stops.
Scope
Scope refers to the parts of the program that are allowed to use the variable.
A good programmer tries to restrict variable access to only the part/s of the program that need the access.
Lifetime of variables
Local variables are initialized to zero each time their sub procedure in which they were declared is called.
Thus, numeric variables get initialized to zero and string variables get set to null.
Module-level variables are initialized when the program first starts, and keep their last assigned value UNTIL
the program is STOPPED.
What is casting?
Casting is the process of converting one data type to another, for example, from an Integer
type to a String type.
ReDim statements. If you try to use an undeclared variable name, an error occurs at compile time. The
Option Explicit Off statement allows implicit declaration of variables.
If used, the Option Explicit statement must appear in a file before any other source code statements.
Use the #Region directive to specify a block of code to expand or collapse when using the outlining feature
of the Visual Studio Code Editor. #Regionstatements support block semantics (such as #If...#End If),
meaning that the start and end must be in the same code block. You can place, or nest, regions within other
regions to group similar regions together
Static variables
A static variable continues to exist and retains its most recent value. The next time your code calls the
procedure, the variable is not reinitialized, and it still holds the latest value that you assigned to it. A static
variable continues to exist for the lifetime of the class or module that it is defined in.
A sub procedure is a section of code that carries an assignment but doesn't give back a result. To create a
sub procedure, start the section of code with the Sub keyword followed by a name for the sub procedure. To
differentiate the name of the sub procedure with any other regular name, it must be followed by an opening
and closing parentheses. The section of the sub procedure code closes with End Sub
It uses the Return statement to specify the return value, and returns control immediately to the calling
program.
It assigns a value to its own function name in one or more statements of the procedure. Control does not
return to the calling program until an Exit Function or End Function statement is executed. The following
example illustrates this.
The advantage of assigning the return value to the function name is that control does not return from the
procedure until it encounters an Exit Function or End Function statement. This allows you to assign a
preliminary value and adjust it later if necessary.
ByRef vs ByVal
In Visual Basic, you can pass an argument to a procedure by value or by reference. This is known as the
passing mechanism, and it determines whether the procedure can modify the programming element
underlying the argument in the calling code. The procedure declaration determines the passing mechanism
for each parameter by specifying the ByVal (Visual Basic) or ByRef (Visual Basic) keyword.