AccountForm

Option Explicit
Dim observer As FormAccountObserver

Public Sub update(modifiedAccount As Account)
    Dim currentEntry As accountEntry
    lstEntries.Clear
    For Each currentEntry In modifiedAccount.getEntries
        lstEntries.AddItem (currentEntry.entryDate & vbTab &
        currentEntry.amount)
    Next
End Sub

Private Sub cmdAdd_Click()
    Call testAccount.addEntry(txtDate, txtAmount)
    Call update(testAccount)
End Sub


Private Sub cmdSpawn_Click()
    Dim frm As New frmAccount
    frm.Show
End Sub

Private Sub cmdSync_Click()
    testAccount.notify
End Sub

Private Sub Form_Load()
    txtDate = Now()
    Set observer = New FormAccountObserver
    Call observer.setForm(Me)
    Call testAccount.attachObserver(observer, CStr(Me.hWnd))
    Call update(testAccount)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call testAccount.detachObserver(observer, CStr(Me.hWnd))
End Sub

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.66.178