Shape Control, Line Control Fig. 5.1, Fig. 5.2 - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Shape Control, Line Control Fig. 5.1, Fig. 5.2

Description:

Pmt method for calculating payments on a loan - Rate for computing interest rate. etc. ... Method 2 Type in the heading and End Sub ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 8
Provided by: Tuc54
Learn more at: https://www.loyno.edu
Category:
Tags: control | fig | line | method | shape

less

Transcript and Presenter's Notes

Title: Shape Control, Line Control Fig. 5.1, Fig. 5.2


1
Sub Procedures and Functions
Shape Control, Line Control Fig. 5.1, Fig.
5.2 The Scroll Bar Controls - properties Min
smallest value Max largest value LargeChange
distance to move when the user clicks on the
gray area SmallChange distance to move when
the user clicks on the arrow Scroll bar
events A scroll bar has two methods associated
with it in this project.


2
Example Fig. 5.3 Form with scroll bars Example
Fig. 5.4 Detail of the scroll bar Example Fig.
5.5 Toolbox tools for creating scrollbars Program
ming example Design and create the form Set the
properties Write the code - go to the upper
left on the code - select vsbMoveCar - under
the method select vsbScroll - under the method
select vsbChange - type in the code for each
procedure
3
The Case Statement - general form Select
Case expression Case constant
list statements Case constant list
statements Case Else OPTIONAL! End
Select Example P. 141 - constant list -
list of values - range of values with TO -
boolean expression
4
- testing strings - use quotes around the
strings - use UCASE or LCASE to avoid
problems Testing Option Buttons with the Case
statement Examples P. 143 IGNORE THE PROCEDURE
HEADING FOR THE MOMENT! They use syntax which we
have not yet covered. Functions for Financial
Calculations - Pmt method for calculating
payments on a loan - Rate for computing interest
rate etc.
5
Writing general procedures These are procedures
which are not associated with any control.
Advantage - avoid duplicating code - simplify
code Method 1 - under Tools select Add
procedure - select Sub and Private - type in
the name of the procedure Method 2 Type in the
heading and End Sub Example P. 147 In this
example, the calling procedures are
vsbMoveCar_Change(), vsbMoveCar_SCroll(),
hsbMoveCar_Change(), and hsbMoveCar_SCroll().
The called procedure is Position_Image().
6
Passing variables to procedures Definition
Suppose Procedure A calls Procedure B. The
programmer may want to allow Procedure B to use a
variable defined in Procedure A. The variable is
said to be passed from A to B, and then back
from B to A. Example Procedure A( ) Dim
iValue As Integer B (iValue) Procedure B
gets iValue and does something End
Sub Procedure B (iValue) do something
involving iValue End Sub
7
Example P. 148 Procedure hsbMoveCar_Change()
calls Procedure MoveHorizontal. Variable
iXPosition is a variable which is defined in
hsbMoveCar_Change() and is then passed to
MoveHorizontal. Functions versus procedures A
function returns one value. The general syntax
is Private Function Function name (parameter)
End Function Example P. 149
Write a Comment
User Comments (0)
About PowerShow.com