Return to IFS 110 class Notes Menu!

Project 3
Multiple Forms,
Dialogs
, Debugging,
and EXEs

New Concepts Project 3

SavU Loan Analyzer

Run-Time Characteristics

SavU Loan Analyzer
System Menu

About... Form Controls

Build the About... form as follows:

Setting Size of Form

Note: Code can be used at run-time to change the form’s size by changing the values (twips) of these properties

Image Control

Line Control

Note: used to visually separate parts of a form (makes the user interface easier to understand)

Properties About... Form

WindowState Property

WINDOWSTATE VALUES

0-Normal window open on desktop

1-Minimized window reduced to icon

2-Maximized window set to maximum size

Run-time WindowState changes

Note: You can control the ability to make run-time changes to the WindowState by including or removing minimize or maximize buttons from the form.

BorderStyle Property Form

BorderStyle Property Values

TABLE 3-2 VB 3.15
0-None

1-Fixed Single

2-Sizable

3-Fixed Dialog

4-Fixed ToolWindow

5-Sizable ToolWindow

 

Note: If BorderStyle is set to none , fixed-dialog, fixed ToolWindow, or Sizable ToolWindow the MinButton, MaxButton, and ShowInTaskbar properties are set automatically to False

Control Names and Captions

Note: Important to name forms, especially in projects that contain more than one form.

Difference between Name and Caption

Font Properties

Note: Font names available are only those installed in Windows on the current PC.

Picture Property
Image Control

Note: Visual Basic Package comes with a set of icon files (.ICO) (choose picture property, double-click graphics subdirectory, choose icon subdirectory)

Picture and BorderStyle Properties
Image Control

Note: Setting BorderStyle to Fixed and the Stretch property to True will cause the icon to be elongated to fill the size of an image control

BorderStyle Line Control

(Table 3-4 VB 3.20)

0 - Transparent
1 - Solid (default)
2 - Dash
3 - Dot
4 - Dash-Dot
5 - Dash-Dot-Dot
6 - Inside Solid
BorderWidth property - sets width of line

SavU Loan Analyzer Form (steps)

Adding Shape Controls

Coping Controls
Keyboard Commands

Adding Scroll Bar Controls

Note: another use of scroll bar is to give a value to an input

2 Kinds of Scroll Bars

Scroll Bar Change Event

Setting Properties

Alignment Property
Text Boxes and Labels

Note: to change text box’s alignment, the value of its MultiLine property must be equal to True (No longer true in VB6)

Scroll Bar Properties

Scroll Bar Properties

Icon Property of Forms

Writing Code

Start Up Form

Note: By default, the Start Up Form is the first form created in a project

Note: In Projects 1 and 2, Start Up Form not specified explicitly because they only contained one form which is automatically set as the Start Up Form

hsbYears_Change and Scroll Events

lblYears.Caption = hsbYears.Value

hsbRate_Change and Scroll Events

Note: This conversion must be done in the code rather than the properties setting section because the Max, Min, SmallChange and LargeChange values can only be set to integer (whole) values

Note: Code copied from the Change to Scroll Event

lblRate.Caption = hsbRate.Value * .01

cmdCalculate_Click Subroutine

Pmt (rate, nper,pv,fv,due)

PMT FUNCTION ARGUMENTS

rate - interest rate per period (monthly = yearly rate / 12)
nper
- total number of payment periods (number of years * 12)
pv
- present value is worth now to lender
fv
- future value or cash balance after final payment (for loan future value is 0)
due
- Number indicating when payments due (0 end of period, 1 beginning of period)

Error Trapping

Example:

IsNumeric(txtAmount.text)

If... Then block

(FIGURE 3-78 VB 3.49)

Extension if Single-line If Statement

IF condition THEN

statement1
statement2

ELSE

statement3
statement4

ENDIF

3 Parts of Message Box

MsgBox text,type,title

Online Help - combinations of buttons, icons, and modality (Table 3-9 VB 3.49)

SetFocus Method

Syntax:

controlname.Setfocus

cmdAbout_Click Event

Note: you make forms visible on the desktop and control their modality at run time with the Show method in a code statement

Form.Show statement

  • form Name of Form to display

    style Integer value that determines if form is modal or modeless (0-modeless, 1-modal)

  • Note: If style value not included (modeless)

    Form_Load Event

    Line Continuation

    Debugging Applications

    Debugging features

    1. Viewing values of variables and properties
        (setting and viewing watch expressions)

    2. Halting execution at a particular point
        (setting a breakpoint)

    3. Executing code one line at a time
        (stepping through the code)

    4. Executing code immediately
        (the Immediate window)

    Setting and Viewing Watch Expressions

    Making Executable Files

    Project 3
    Multiple Forms,
    Dialogs, Debugging,
    and EXEs
    END

    Program Future Value Calculator Requirements

    Return to IFS 110 class Notes Menu!