- C -
Hour 1 Quiz
- 1. To develop Windows applications
2. Programming languages are now visual to handle Windows environments.
4. Form window
5. The Learning Edition is Visual Basic's least expensive start-up version. The Professional
Edition includes additional tools, including the help compiler and the ActiveX Custom
Control Edition. The Enterprise Edition includes all the Professional Edition tools,
as well as advanced client/server system technology.
6. The Form window holds the application's form background and all its user controls,
such as command buttons. The Form Layout window lets you adjust the Form window's
location on the user's screen when the user first executes the application.
7. The size coordinates appear in the upper-right corner of the Visual Basic Development
Hour 1 Exercise
No answer is necessary.
Hour 2 Quiz
- 1. Windows programs are visual and include graphic elements the user interacts
with to control the program. In addition, Windows programs respond to events, whereas
text-based programs guide the user more rigidly and the programs control the user's
2. Events occur during your application's execution and usually, but not always,
occur in response to the user's action, such as a mouse button click or a keystroke.
3. The Project window's component filenames use common filename extensions such as
.vbp and .bas, but Visual Basic does not use filename extensions
when referring to those components.
5. The procedure's event procedure determines the code that executes when the event
7. Control property changes show themselves at design time and at runtime, whereas
event procedures execute only at runtime.
Hour 2 Exercise
No answer is necessary.
Hour 3 Quiz
- 1. Double-click the control on the Toolbox window to place the control on the
2. The sizing handles let you move the control and change its size.
3. Hold down the Ctrl key when you click each control, or lasso multiple controls
by dragging a square around them with the mouse.
4. True (such as the Top and Left properties)
5. The Caption property sets the form title.
6. A control is a type of object; objects also can include the form, menus, and other
7. Add tooltips to controls when you place the controls on the form.
8. A dialog box appears when you click a control property's ellipsis to let you fill
in multiple values related to the control property.
Hour 3 Exercises
- 1. See the CD-ROM's project named Lesson 3 Exer 1.
2. See the CD-ROM's project named Lesson 3 Exer 2.
Hour 4 Quiz
- 1. False; the focus appears at runtime, not at design time.
4. Set the control's Cancel property to True.
5. The Enabled property
6. Labels do not respond to user-generated events.
7. The label expands horizontally before you have a chance to set the WordWrap
property. WordWrap does you no good when the label is so long no wrap is
8. The form may not hold multiple autosizing labels that hold a large amount of text.
Hour 4 Exercises
- 1. See the CD-ROM's project named Lesson 4 Exer 1.
2. See the CD-ROM's project named Lesson 4 Exer 2.
Hour 5 Quiz
- 1. A data type describes the kind of data a variable can hold.
2. A string holds zero or more characters whereas a boolean data type holds only
one of two values, True or False.
3. Option buttons and check boxes
4. A literal's value never changes.
5. 12Months, 85
6. The plus sign performs addition and concatenation. In addition, the equal sign
assigns values as well as tests for equality.
7. Fixed-length strings set a limit on the number of characters they can hold.
8. a. 8
Hour 5 Exercises
- 1. Dim strFirst As String
Dim strLast As String
Dim intAge As Integer
Dim sngTaxRate as Single
Dim blnMarried As Boolean
- 2. See the CD-ROM's project named Lesson 5 Exer 2.
Hour 6 Quiz
- 1. A message box is not a control, but a dialog box that appears when needed
to get information from the user. A text box is a control that resides on the form.
2. A text box stays on the screen longer, in most cases, than an input box.
3. When you use a named literal instead of placing literal values throughout an application,
you only need to change one line if you have to modify the literal's value.
4. The apostrophe and the Rem statement are both remarks.
5. Remarks are for people who look at your program code.
6. Modality determines how the dialog box reacts to the user's input.
7. You can display one of four icons in a message box.
8. False; you can return a maximum of one value from a function.
9. The input box returns the default value if the user does not change the default
Hour 6 Exercises
- 1. ` Programmer name: Julie Russell
` Date: November 27, 1999
` This program is to calculate sales taxes
` based on the customer sales values
- 2. varAge = InputBox("How old are you?", "Age Request",
Hour 7 Quiz
- 1. Comparison operators return boolean results and perform no math.
2. The ASCII table determines the order of character comparisons.
3. a. True
4. Code the Else portion if you want to specify execution for the If's
false comparison result.
6. Select Case
7. Case expr1 To expr2
8. The statement following the End Select executes.
9. Every statement in the code block executes if that leg of the Select Case
10. The End Else should be End If.
Hour 7 Exercises
- 1. If (A > 3) And (B > 10) Then
lblAns.Caption = "Yes"
- 2. If (X >= 10) And (Y < 20) Then
Hour 8 Quiz
- 1. Your program might need to repeat one or more statements.
3. False; they check for the condition at different locations in the loop.
4. The Do-Loop While loop continues as long as the condition is True
and the Do-Loop Until loop continues as long as the condition is False.
5. The Do Until checks its condition at the top of the loop.
6. Val() converts string values to numbers.
7. True if you use a negative Step value
8. 10 times
10. False; Exit supports several forms, including an Exit that
exits the current subroutine, an Exit that exits the current function, and
an Exit that exits the current loop.
Hour 8 Exercises
- 1. See the CD-ROM's project named Lesson 8 Exer 1.
2. Dim strAge As String
Dim intAge As Integer
Dim intPress As Integer
strAge = InputBox("How old are you?", "Age Ask")
` Check for the Cancel command button
If (strAge = "") Then
End ` Terminate program
intAge = Val(strAge)
If (intAge < 10) Then
` The user's age is too low
intPress = MsgBox("Your age is too low!" _
ElseIf (intAge > 99) Then
` The user's age is too high
intPress = MsgBox("Your age is too high!", _
Loop While ((intAge < 10) Or (intAge > 99))
Hour 9 Quiz
- 1. The StartUpPosition determines the form's initial location on the
2. So the user can quickly move to the text box next to the label
3. Enter ToolTipText properties when you add controls because you are more
familiar with the controls' purpose at that time.
4. A control array is a collection of controls that have the same name and many similar
5. Visual Basic assumes that you want to add a similar control, and control arrays
often hold similar controls.
6. Lock the text in a text box when you don't want the user to be able to change
7. Unload the form and then issue the End statement.
8. A runtime error occurs because you cannot divide by zero.
9. True; Caption is a label's default property. Of course the wording differs,
but the statements perform the same action.
10. A function procedure returns a value to the calling procedure, whereas a subroutine
procedure never returns a value.
Hour 9 Exercises
- 1. See the CD-ROM's project named Lesson 9 Exer 1.
2. See the CD-ROM's project named Lesson 9 Exer 2.
Hour 10 Quiz
- 1. At runtime
2. The AddItem method
3. The ListCount method
6. Specify the Style property to change a combo box style.
7. False; users cannot enter items into a drop-down list box.
8. A collection of variables with the same name
Hour 10 Exercises
- 1. See the CD-ROM's project named Lesson 10 Exer 1.
2. See the CD-ROM's project named Lesson 10 Exer 2.
Hour 11 Quiz
- 1. False
2. The option clicked becomes the selected option button, and the one that was selected
no longer is selected.
3. The item might be temporarily unavailable.
4. The check box becomes selected, and any others that were already selected still
6. Any control can go on a frame.
7. The Small Change property determines the amount of scrolling that takes
place when the user clicks the scroll bar arrows and the Large Change property
determines the amount of scrolling that takes place when the user clicks the scroll
bar on either side of the scroll thumb.
8. The Value property changes when the user clicks the scrollbar.
9. False; the Timer control triggers events every time a fixed number of milliseconds
10. False; through programming you can make a single Timer control any timed interval.
Hour 11 Exercises
- 1. The Index value that you use in the Select Case will be
the argument passed to the procedure.
2. The form requires no frame because the user can select multiple check boxes at
once, unlike option buttons.
3. Set the Timer control's Interval property 1000. Use an If
at the start of the timer's event procedure so that the label's size grows no larger
than 70 points.
Hour 12 Quiz
- 1. 6
2. Programming is easier and your applications are more consistent with each other
and with other Windows applications your users already know.
4. False; these actions are available all from one control, the Common Dialog
5. The Filter property controls the filename extensions that appear.
6. ShowColor, ShowFont, ShowHelp, ShowOpen, ShowPrinter,
7. The Type property is not set.
8. Check the FileName property.
10. The Printer dialog box does no printing but only sets up printing.
Hour 12 Exercises
- 1. No answer is necessary.
2. See the CD-ROM's project named Lesson 12 Exer 2.
3. No answer is necessary.
4. See the CD-ROM's project named Lesson 12 Exer 4.
Hour 13 Quiz
- 1. Your programs are easier to write and easier to maintain when you write structured
2. False; structured programming puts off details.
4. The keyword should be Sub.
5. If the procedure uses no arguments, Call is optional.
6. X is module global and Y is project global. The variables would
be the same if they appeared in an external module.
7. Don't include the array subscript.
8. The arguments are local to the calling procedure so the called procedure needs
to know the data types being passed.
9. By the passed argument list
10. ByRef is the default argument passing process, so if you want to pass
by reference, you do not need to specify the ByRef keyword. If, however,
you want to pass by value, you must specify ByVal.
Hour 13 Exercises
- 1. Public Function By10 (ByRef intVal As Integer) As Integer
By10 = intVal * 10
- 2. Public Sub LblSng (ByVal a1 As Single, _
ByVal a2 As Single, ByVal a3 As single)
lblSng1.Caption = a1
lblSng2.Caption = a2
lblSng3.Caption = a3
Hour 14 Quiz
- 1. None; the built-in functions are part of the Visual Basic language.
2. a. abc
3. A statement
4. A function
5. a. 20
8. A thousands separator is used at each thousand's place in a number. For example,
a comma appears as this number's thousand's separator: 45,419.12.
9. False; use Format() to display your dates in the format you want them
Hour 14 Exercises
- 1. Dim strASCII As String(256)
For intCtr = 0 To 255
StrASCII(intCtr) = Chr(intCtr)
- 2. Public Sub getTime()
Dim dteTimeIn As Date
Dim dteTimeOut As Date
Dim lngSec As Long
Dim intMin As Integer
Dim intHours As Integer
dteTimeIn = InputBox("What time did you check in?", "Check In")
dteTimeOut = InputBox("What time did you check out?", "Check Out")
lngSec = DateDiff("s", dteTimeIn, dteTimeOut)
intMin = DateDiff("n", dteTimeIn, dteTimeOut)
intHours = DateDiff("h", dteTimeIn, dteTimeOut)
lblSecWorked.Caption = lngSec
lblMinWorked.Caption = intMin
lblHoursWorked.Caption = intMin/60
- 3. ` You may want to add input validation to ensure
` that the user enters a reasonable age.
Public Sub getTime()
Dim dteBirth As Date
Dim intYrsRetire As Integer
Dim intAge As Integer
dteBirth = InputBox("When were you born?", "Birthday")
Loop Until IsDate(dteBirth)
intAge = DateDiff("yyyy", dteBirth, Now)
If intAge >= 65 Then
msg = MsgBox("Congratulations on a long life!" _
, vbExclamation, "It's great!")
intYrsRetire = 65 - intAge
msg = MsgBox("You have only " & intYrsRetire & _
" years to retire!", vbExclamation, "Soon...!")
Hour 15 Quiz
- 1. A database is an organized collection of one or more tables of records.
2. A record is a row, and a field is a column from a file.
3. A table is a file in a relational database.
4. The file is overwritten.
5. The file is added to.
6. All open files
7. False; only for the tables you want to work with
8. If the user changes the bound control, the underlying database value changes also.
9. An option button or a check box
10. Use the VB Data Form Wizard
Hour 15 Exercises
- 1. Public Sub WriteValues()
Open "c:\friends.dat" For Output As #1
Write #1, "George", 35, "912-3344"
Write #1, "Elaine", 31, "649-1999"
Write #1, "Jerry", 34, "912-5712"
Write #1, "Kramer", 38, "747-1123"
Write #1, "Newman", 32, "648-2900"
Public Sub ReadValues()
Dim strName(6) As String
Dim intAge(6) As Integer
Dim strPhone(6) As String
Open "c:\friends.dat" For Input As #1
For intCtr = 1 to 5
Input #1, strName(intCtr), intAge(intCtr), _
` Code goes here that processes data
- 2. See the CD-ROM's project named Lesson 15 Exer 2.
3. No answer is available.
Hour 16 Quiz
- 1. The output goes to the Windows print manager.
2. An error message box appears.
3. The Printer object receives data sent by the Print method.
4. Specify the Copies property.
7. Use Chr() to print special characters on the printer.
Hour 16 Exercises
- 1. Printer.Print Chr(209)
2. For intCtr = 32 to 255
- 3. See the CD-ROM's project named Lesson 16 Exer 3.
Hour 17 Quiz
- 1. True
5. The indentation determines the menu level.
7. File | Exit
8. The user will not adapt as quickly to your application.
10. The Checked property
Hour 17 Exercises
- 1. See the CD-ROM's project named Lesson 17 Exer 1.
2. The answer is not available, so that copyright information can be maintained in
Visual Basic's prepackaged Atm example.
Hour 18 Quiz
- 1. The Picture Box and Image controls display graphic images.
2. The Image control is more efficient than the Picture Box control.
3. The Image control will shrink to measure the same size as the loaded picture.
4. The Picture Box does not resize to measure the same size as the loaded graphic
5. The Image control enlarges to display the entire image.
6. The Picture Box does not enlarge to display the full image, but rather, clips
7. The assignment is missing the LoadPicture() function.
8. The Timer control helps you control animation effects.
9. False; only local variables can be static.
10. Visual Basic initializes static variables at compile time, so the first time
through the procedure, the variable has an initial value.
Hour 18 Exercises
- 1. Set the Timer control's Enabled property to False in the
Properties window. In the Click event procedure, set the Enabled
property to True to begin the animation. Be sure to set the command button's
Style property to Graphical before putting the happy face on the
2. No answer is available.
Hour 19 Quiz
- 1. The Professional and the Enterprise Editions support the Toolbar control.
2. The Toolbar control does not appear as an intrinsic control on the Toolbox window.
3. The Image List control
4. The Key property determines which string returns when a toolbar button
5. The argument value determines which toolbar button is clicked.
8. False; LoadPicture() is for the Picture Box and Image controls.
9. The FillStyle property determines the interior pattern of shapes.
10. True; you can set the shape's border and interior colors.
Hour 19 Exercises
- 1. See the CD-ROM's project named Lesson 19 Exer 1.
2. See the CD-ROM's project named Lesson 19 Exer 2.
3. See the CD-ROM's project named Lesson 19 Exer 3.
Hour 20 Quiz
- 1. Syntax errors are the easiest to find.
2. Logic errors are the hardest to find.
3. A runtime error occurred.
4. Visual Basic's title bar tells the current mode.
5. A stopping point during a program's execution where all variables are kept active.
6. Look at the variables, add variables to the Watch window, single-step through
the rest of the program, add other breakpoints, remove breakpoints, or terminate
7. Click the Debug toolbar's Step Through button at any breakpoint. You can also
press F8 to step into the next line or Shift+F8 to step over the line.
9. Click the Quick Watch button or rest the mouse pointer over the variable to see
10. The Print method displays values in the Immediate window.
Hour 20 Exercises
- 1. Larry is not printing to the Debug object.
2. No answer is necessary.
Hour 21 Quiz
- 1. VB custom controls
2. Use the Components dialog box.
3. From online services such as the Internet and CompuServe, and you can also write
5. Use the existing similar control as a basis for the new ActiveX control.
7. The user can double-click the embedded object or its icon.
8. An ActiveX document is an application that an ActiveX container is capable of
displaying during execution as a child process.
9. Internet Explorer is an ActiveX container.
10. Run the ActiveX Document Migration Wizard to convert a form to an ActiveX document.
Hour 21 Exercises
- 1. No answer is available, so that copyright information can be maintained for
Word and WordPad.
2. No answer is needed. Run the wizard to convert the application to an ActiveX document.
Hour 22 Quiz
- 1. Form, Printer, and Screen
2. A class defines objects, and an object is a single instance of a class.
3. Visual Basic creates a new object.
7. Use the Before named argument to insert items at the beginning of a collection.
9. Active Automation
Hour 22 Exercises
- 1. Public Sub FontDecrease()
For intCtr = 0 to Controls.Count - 1
Controls(intCtr).Font.Size = Controls(intCtr).Font.Size _
- 2. No answer is necessary.
Hour 23 Quiz
- 1. The program loads and runs faster, is more secure, and does not require Visual
Basic's Development Environment to run.
2. False; use the Make option.
3. To maintain records of multiple versions of an application
4. Use the form's icon located in the form's Icon property.
5. False; you must run the installation routine from the Start menu.
6. A dependency file is a file needed by an application's installation to install
and execute properly. The dependency file specifies the names of all the files the
application requires, such as certain fonts, controls, and ActiveX files.
8. In case you want to copy the installation to floppy disks
9. The installation routine gives the user a chance to save the newer version.
10. The user can run the uninstall routine from the Control Panel.
Hour 23 Exercise
- No answer is necessary; no source code changes from the original application.
Hour 24 Quiz
- 1. The Internet
2. The VB Application Wizard supports both.
5. An ISP is used to gain Internet access.
6. Only if you want to test the Internet-based application do you need an ISP. In
most cases, you should have an ISP.
7. Java-enabled Web pages are more active than non-Java pages. For example, a Java-enabled
Web page can contain a multimedia video clip that runs on the user's own computer.
The Java application's runtime speed is not dependent on download speed because a
Java application executes on the end user's machine.
8. The Web Browser tool requires a toolbar and an Image List.
9. False; you must add a logoff routine.
10. Click the Back button, display the pull-down URL listbox, type the URL address
in the text box, or select the Open dialog box and type the URL of the page you just
Hour 24 Exercise
- No answer is necessary as this exercise simply directs a process.