Académique Documents
Professionnel Documents
Culture Documents
Modules
Please use speaker notes for
additional information!
Enter 100 in
Transaction
Amount and
Click Deposit.
Click on reset to
transfer into
balance.
Enter amount
and click on
withdrawal.
Click on reset to
make opening
balance.
SavAcct.vbp
SavAcct.vbp
vTranAmt is the
information passed to
the deposit or
withdrawal method.
SavAcct.vbp
SavAcct.vbp
objSavAcct is
dimensioned
objSavAcct is instantiated
Occurs before the focus shifts to a (second) control that has its CausesValidation property set to
True. from Microsoft VB In fact, I am not really doing validation here, I am assigning.
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct00.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
RaiseEvent on
insufficient funds.
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct01.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
Option Explicit
'A collection is a container object - it contains objects
'A collection can only have certain methods such as Add, Remove and Item
Private colSavAccts As Collection
Private Sub Class_Initialize()
Set colSavAccts = New Collection
End Sub
Public Sub Add(ByVal vAcctNbr As String, ByVal vIntRate As Integer)
Dim NewSavAcct As New SavAcct
This sets up a NewSavAcct which is an object of the
With NewSavAcct
.AccountNumber = vAcctNbr
SavAcct type and then adds it to the collection.
.IntRate = vIntRate
colSavAccts.Add NewSavAcct, .AccountNumber
End With
'The last line of the with block actually adds the NewSavAcct object to the savings
'accounts collection (SavAccts) and uses the AccountNumber as a key to the
'collection. You can retrieve that object from the collection by using the
'AccountNumber.
End Sub
Public Sub Remove(ByVal vAcctNbr As String)
colSavAccts.Remove vAcctNbr
End Sub
SavAcct02.vbp
SavAcct02.vbp
Option Explicit
'A collection is a container object - it contains objects
'A collection can only have certain methods such as Add, Remove and Item
Private colSavAccts As Collection
Private Sub Class_Initialize()
Set colSavAccts = New Collection
End Sub
SavAcct02.vbp
SavAcct02.vbp
Public Function NewEnum()
Set NewEnum = colSavAccts.[_NewEnum]
End Function
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
SavAcct02.vbp
Private Sub Form_Load()
Set objSavAcct = New SavAcct
Set colSavAccts = New SavAccts
Call Initialize_Variables
End Sub
Public Sub Initialize_Variables()
wkAcctNbr = ""
wkBalance = 0
wkIntRate = 0
wkTranAmt = 0
txtAcctNbr.Text = ""
lblOpnBal.Caption = ""
lblClsBal.Caption = ""
txtIntRate.Locked = False
txtIntRate.Text = ""
txtIntRate.Locked = True
txtTrnAmt.Text = ""
cmdDpsit.Enabled = True
cmdWthDrwl.Enabled = True
cmdReset.Enabled = True
End Sub
SavAcct02.vbp
SavAcct02.vbp
Private Sub cmdSetInt_Click()
With txtIntRate
.Appearance = 1
.BackColor = &H80000005
.BorderStyle = 1
.Locked = False
.SetFocus
End With
End Sub