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
18.219.236.70