Term
Keywords (Reserved Words) |
|
Definition
* Words with special meaning that make up a programming language
*Cannot be used for any other purpose |
|
|
Term
|
Definition
*Special symbols that perform various operations on data
example: +, -, *, / |
|
|
Term
|
Definition
*Storage loation in memory represented by a name
*Name is chosen by the programmer
*In VB name must start with a letter or underscore |
|
|
Term
|
Definition
*Set of rules that dictate how keywords, operators, variables and punctuation characters must be used
*If a single syntax error appears in a program, it will not compile or execute |
|
|
Term
|
Definition
* Individual instructions in your program
*Made up of keywords, variales, operators and punctuation
*One statement is one line of source code
ex: assigning a value to a variable |
|
|
Term
|
Definition
*Set of statements that perform a specific task
*A procedure has a name
*Can be executed from elsewhere in the program |
|
|
Term
|
Definition
*Ignored by the compiler
*Helps programmer understand the purpose of programming statements
*Beings with '
|
|
|
Term
|
Definition
*Part the user interacts with
*All user interfaces were comand line
*Modern user interfaces are graphical (GUI) |
|
|
Term
|
Definition
*Like a variable but in addition to containing data, it also has the ability to perform actions
*Objects properties - data that the object contains
*Object's methods - actions the object can perform
*Name chosen by the programmer |
|
|
Term
|
Definition
*Usually appears in a programs graphical user interface |
|
|
Term
|
Definition
*The window that contains the other elements |
|
|
Term
|
Definition
*The small boxes that accept input |
|
|
Term
|
Definition
*Areas that simply display text |
|
|
Term
|
Definition
*Perform operations when clicked with the mouse |
|
|
Term
|
Definition
*An action that takes place within a program
*All VB controls are capable of detecing various events, such as:
Clicking a button control
or
Changing the text in a text box |
|
|
Term
|
Definition
*For a control to respond to a specific event, you must write a special type of procedure |
|
|
Term
|
Definition
*Each property has a value
*Some properties deal with the control's appearance |
|
|
Term
|
Definition
*Establishes a means for the program to refer to that control
|
|
|
Term
|
Definition
*First three characters indicate the type of control
ex: lbl,txt,btn |
|
|
Term
|
Definition
1. Clearly define what the program is to do
2. Visualize the application running on the cpu and design user interface
3. Determine the controls needed
4. Define the values of each controls relevant properties
5. Determine the eents of each control that you need to handle
6. Create a flowchart or pseudocode verison of code
7. Check the flowchart or pesudocode for errors
8. Start VB and create forms and ontrols
9. Use the flowchart to write code
10. Compile the program
11. Run the program |
|
|
Term
|
Definition
*Problem with syntax of the source code
|
|
|
Term
|
Definition
Lightning Bolt in the properties window |
|
|
Term
|
Definition
*the first line of the event handler
*We then add code to execute what we want |
|
|
Term
|
Definition
*Change a property at run-time
*[Control Name].[Property Name]=[value]
TextBox1.Text = "Hello World" |
|
|
Term
|
Definition
*Assigns the value of the item on the right to the item that appears on the left side.
*The item receiving the value must be on the left! |
|
|
Term
|
Definition
Auotmatic code completion |
|
|
Term
Calling a method with code |
|
Definition
*ObjectName.MethodName()
example: TextBox1.Clear()
or
Me.Close()
Me is a keyword that refers to the current form. |
|
|
Term
|
Definition
*Property is a wrench icon
*Methods are cube icons |
|
|
Term
|
Definition
MessageBox.Show("Hello User!")
"Hello User!" is a string literal
OR
MessageBox.Show(TextBox1.Text) |
|
|
Term
|
Definition
F1 is context sensitive: it opens the documentation for the item selected, or the item that the cursor is on.
ctrl-f1 for general help |
|
|
Term
|
Definition
Microsoft Developer Network
*Left hand pane is a directory. You can browse through the documentation.
* You can also search documentation using the search box (upper right corner) |
|
|
Term
|
Definition
*Compile-Time Error = problem with the syntax of the source code
*Run-Time error = problem that causes the program to fail while running |
|
|
Term
|
Definition
Prevents the program from compiling
ex: Me.Clost()
'Clost' is not a member of 'WindowsApplication1.Form1'
*You can double click the error message to go to the line of code
*Jagged underline in the code window |
|
|
Term
|
Definition
*A storage location in coputer memory that holds data while a program is running
*Called a variable because the data it holds can change |
|
|
Term
|
Definition
*A statement that creates a variable in memory
* Indicates:It's name, and the type of data it will hold |
|
|
Term
|
Definition
Syntax for declaring a variable
*Dim VariableName As dataType
Ex: Dim intLength As Integer |
|
|
Term
|
Definition
*Dim keywords says we are declaring a variable.
*intLength is the variables name
*As integer indicates the variable will hold integer numbers |
|
|
Term
|
Definition
*Guideline to help improve readability but are not required syntax.
*A variable name should describe its use
*Data type prefix is lower case
*Subsequent word should be capitalized |
|
|
Term
Assignment statement
Assign value 112 to variable intLength |
|
Definition
|
|
Term
Assign the string literal "Good Morning" the the variable strGreeting |
|
Definition
strGreeting = "Good Morning"
An assignment only changes the left operand |
|
|
Term
Assign the contents of the text box txtName to the variable strGreeting |
|
Definition
strGreeting = txtName.Text |
|
|
Term
Assign the string literal "Good Morning" followed by the contents of the text box txtName to the variable strGretting |
|
Definition
strGreeting = "Good Morning " & txtName.Text
& is the string concatenation operator |
|
|
Term
|
Definition
Values that will always be a whole number
*Byte - byt - unsigned integer from 0 to 255
*Short- shrt- signed integer from -32,768 to 32,767
*Integer- int- Signed from -2,147,483,648 to 2,147,483,647
*Long -lng - signed from -9,222,372,036,854,775,808 to 9,223,372,036,854,775,807 |
|
|
Term
|
Definition
*Values that may have fractional parts
*Single-sng- 10 to the 38 plus or minus 7 decimals
*Double-dbl 10 to the 308 plus or minus 15 decimals
*Decimal -dec-10 to the 29 plus or minus 29 decimals |
|
|
Term
|
Definition
*Boolean-bln- either true or false
*Char- chr- holds a single character
*String-str-holds a sequence of up to 2 billion characters
*Date -dat-can hold date and time |
|
|
Term
|
Definition
*We usually want to initalize variables, unless we'll be assigning a value prior to using the variable
ex: Dim intLength As Integer = 12 |
|
|
Term
|
Definition
*The part of the program where a variable is visible
*Variable name can only be used once within its scope
cant do:
Dim intValue As Integer
Dim intValue As Integer
|
|
|
Term
|
Definition
*Variable declared inside a procedure, only visible in the procedure in which it appears
must list Dim intValue As Integer
intValue = 12
Cant just put intValue = 12 |
|
|
Term
|
Definition
*Variable declared inside a class but outside any procedure, visible throughtout all procedures of the class
can just do intValue = 25
difference between the two is this one has end class at the bottom |
|
|
Term
|
Definition
*A constat is similar to a variable except it must be given an inital value, and once it is declared, its value cannot be changed.
*declare with const instead of Dim
ex: Const VariableName As DataType = value
Const dblSALES_TAX_RATE As Double = 0.065 |
|
|
Term
|
Definition
*Simplify code maintenance
*Make code easier to understand
*After the 3 character prefix name should be in ALL upper case letters
|
|
|
Term
Arithmetic Operator : Addition |
|
Definition
dblTotal = dblPrice + dblTax |
|
|
Term
Arithmetic Operator : Subtraction |
|
Definition
dblNetPrice = dblPrice - dblDiscount |
|
|
Term
Arithmetic Operator : Mutliplication |
|
Definition
intArea = intLength * intWidth |
|
|
Term
Arithmetic Operator : Division |
|
Definition
dblAverage = intTotal / intItems |
|
|
Term
Arithmetic Operator : Exponentiation |
|
Definition
|
|
Term
Combined Assignment Operators |
|
Definition
*Sometimes we need to change the value in a variable with an operation, such as adding a number to it
intQuantity += 1
is like intQuantity +1 |
|
|
Term
|
Definition
*Operator precedence tells us the order in which operations are performed.
Highest to lowest
1. Exponentiation
2. Mutiplication and division
3. Addition and subtraction |
|
|
Term
|
Definition
*A value of one data type can be assigned to a variable of a different type.
implicit and explicit |
|
|
Term
|
Definition
*A numeric type conversin will be either widening or narrowing
*Widening conversion suffers no loss of data
ex: converting an integer to a double
Dim dblVal as Double = 5
*Narrowing conversion may lose data
ex: converting a deciaml to an integer
Dim intNum As Integer = 12.2 becomes 12
Dim intNum as Integer = 12.5 becomes 13 |
|
|
Term
|
Definition
*Cint - converts expression into an integer
*CDbl- converts expression to a double
*CDate- converts expression to a date
*CDec - converts expression to a decimal
*CStr- converts expression to a string |
|
|
Term
Explicit Type Conversion Examples |
|
Definition
*Rounding with CInt
intCount CInt(12.4) value is 12
*CStr converts a numberic value to string
Dim strText As String = CStr(3.14) value is 3.14
*CDec converts string to decimal
Dim decPay As Decimal = CDec ("1,500") converts to 1500.0
*CDate
Dim datHired as Date = CDate("9/14/2014") |
|
|
Term
|
Definition
*xyz cant be converted to a number
*theres no 35 day in a month
*These cause a runtime error |
|
|
Term
Formatting Numbers and Dates with ToString |
|
Definition
*Converts the contents of the variable to a string.
*Call by using the dot operator
ex: VariableName.ToString()
Dim number As Integer = 123
lblNumber.Text = number.ToString()
^ This converts the integer 123 to the string "123" and assigns it to the text property of the lblNumber control |
|
|
Term
Formatting Numbers and Dates with ToString |
|
Definition
Dim decGrossPay As Decimal
Dim strResult As String
decGrossPay = 1228.54
strResult = decGrossPay.ToString("c")
changes the format string into currency |
|
|
Term
|
Definition
Exception is any error condition or unexpected behavior that is encountered by an excuting program
ex: Dim dblSalary As Double = CDbl ("xyz")
*Allows a program to fail gracefully and recover if possible
*A runtime error results when an exception is unhandled |
|
|
Term
|
Definition
Try Catch statement
*Try block contains program statements that might throw an exception
*The catch block contains statements to execute if an exception is thrown
Try
'Try block statements.....
Catch
'Catch block statements
End try
|
|
|
Term
|
Definition
If your program compiles and runs, but does not work correctly or produces incorrect results |
|
|
Term
|
Definition
*Breakpoints
*Watch windows
*Single-stepping through the program |
|
|
Term
|
Definition
*Click the mouse in the left margin of the code window
*A red dot appears next to the line in the left margin and the line becomes highlighted. This indicates that a breakpoint has been set on this line
*When you run the program, execution will pause on this line |
|
|
Term
|
Definition
*While your program is paused on a breakpoint you may inspect the contents of variables and object properties
|
|
|
Term
|
Definition
*Executing code one line at a time. Press F8 to execute the current line and then pause at the next line. The execution point is indicated by yellow highlighting and small arrows.
*Press F5 to contine normal execution |
|
|
Term
|
Definition
*Only one control can have the focus
* txtUserName.Focus()
*It has focus by it's blinking or thin dotted line |
|
|
Term
|
Definition
*Moves focus from one control to another by pressing tab key.
*default: tabs are in the same order as you created them
* go to view menu, click tab order, click the control sequentially to establish the tab order you want, when finished click tab order on the view menu again to leave.
*Also can change in properties window TabIndex property |
|
|
Term
|
Definition
*Encloses boxes with a bigger box.
*Boxes within are related in some way |
|
|
Term
|
Definition
*Alt + x = Exit
* The access key will appear underline on the control |
|
|