Introduction to Programming
Terms
undefined, object
copy deck
- List the three types of loops(not structures) and explain the difference between them.
-
Event-driven loops
Determinate loops
Indeterminate loops - Event-driven loops
- Are repeated by the user causing an event to occur, such as by clicking a command button.
- Determinate loops
- repeat a known number of times.
- Indeterminate loops
- repeat an unknown number of times.
- What is the result of a loop that does not have a valid termination condition?
- An endless (indefinite) loop.
- Summing
-
adding some value to an existing sum
Example 2+3+5=10 - Counting
-
adding one to a counter
Example 1+1+1+1=4 - Local variable
- variable only known to one event
- Form Level
- Variables are known to all procedures on the form and retain their value between events
- Static variables
- retain their value between events but are local to event procedure
- Project variables
- are known to the whole project, with multiple forms and are contained in a module of their own
- What method is used to add items to a list box?
- .Additem
- What method is used to delete items from a list box?
- .RemoveItem
- What is the best loop structure for a determinate loop?
- For-Next
- Pre-test loop
- have termination condition before loop body
- Post-test loop
- the body of the loop is executed and then the condition is tested
- Sequential access files
- files from which the data records must be input in the same order that they were placed on the file
- Direct access files
- files that can be input in any order
- Database files
- entered with a database management system and not input directly into a VB project
- What is the invisible binary marker at the end of a file called?
- EOF marker
- What is the correct line of code for opening a file?
-
Open "filename" for Input as #n
Example: Open "a:\chapter5\sumdata.txt" for Input as #10 - What is the correct line of code for inputting data from a file?
- Input #n, list of variables
- Nested loop
-
A loop within a loop.
Must complete the inner loop within the outer loop. - 3 rules to remember about using nested loops.
-
-Always use different counter variables for the outer and inner For-Next loops.
-Always have the Next statement for the inner For-Next loop before the Next statement for the outer For-Next loop.
-Always include the counter variable in the Next statements to distinguish between the loops. - control array
- group of the same type control, which is assigned a single name
- What lower index value does an array normally start with?
- 0
- What is the best decision structure to use when working with an array?
- Case Select
- Check box
-
is used to make multiple selections from a list
Prefix is chk - Option button
-
is used to make one selection from a list. Often referred to as radio buttons
Option buttons must be within a frame control which acts as a container.
Prefix is opt - What is the purpose of a frame?
-
Serves as a container for other controls
If the frame is moved, option buttons will move with it
Prefix is fra - How many option buttons can be checked within each frame?
- 1
- What is the proper syntax for declaring a one-dimensional array?
-
Dim ArrayName(max index value) as variable type
Dim curPrices(9) as Currency - What is a flag variable used for and what data type is it?
-
often used to indicate whether a match was found.
It is a Boolean data type, so it has a value of True or False - Explain the procedure to add a newly created form to an existing project.
- Add a form by clicking Project/AddForm or click on the Add Form icon on the toolbar.
- What is the proper syntax for declaring a two-dimensional array?
-
Dim ArrayName(max row index,max column index)as var type
Dim NumberTable(10,20)as Single - List some key rules about using passwords
-
-are often used to control access to a computer or software program
-should be at least 6 characters in length and something that cannot be easily guessed - List some key rules about password forms
-
-should be the Startup object
-A user should be given a set number of "chances" to enter the correct password - On a command button, what affect does setting its Default property to True have?
- it will execute the click event if the Enter key is pressed
- On a command button, what affect does setting its Cancel property to True have?
- it will activate the click event if the Escape key is depressed
- What VB Tool is used to create menus?
- the Menu Editor
- What are some general rules about which controls should be made into menu items?
- Frequently used items should remain as buttons while less frequently used items could be menu items
- What type of events are menu options?
- Click
- What is an About Screen used for?
- to provide information about the application and is often found under the Help menu item.
- What does the Unload Me command do?
- Unloads current form from memory
- When creating a memo form, what control must be added to the toolbox that will allow you to display dialog boxes?
-
The common dialog control which must be added to the Toolbar with the
Project/Components - What does the Multiline property for a text box allow you to do?
-
The textbox should have its Multiline property set to True.
allows any text entered in the text box to wrap when it reaches the boundary of the text box