[AccessD] Framework Discussion - Who's following this

DWUTKA at marlow.com DWUTKA at marlow.com
Fri Mar 12 11:56:28 CST 2004


1) Interest Level: Kind of (a).  I do a lot of ASP stuff, with VB .dll's in
the background.  Even though I am not dealing with 'bound forms', I am still
creating a project framework, that handles the 'transactions'.  Similar
concepts.

2) Understanding: Understand what you are doing just fine, so I guess that's
(a) again.

3) Participation: Not on the list.  So (e): reading the posts just to see if
you're doing something I haven't discovered myself. Basically, reading for
the sake of picking up new tips/tricks.

Something I'd like to ask, in an earlier post, you were explaining how you
were 'linking' your Class objects.  Just out of curiousity, why not do
something like this:

FrameWorkControl Class:
Option Compare Database
Property Set LinkedObject(objTemp As Object)

End Property
Public Function CleanUp()

End Function
Property Get ObjectName() As String

End Property
Property Get ObjectType() As String

End Property

FWComboBox Class:
Option Compare Database
Implements FrameWorkControl
Dim WithEvents lnkObject As ComboBox
Private Function FrameWorkControl_CleanUp() As Variant
Set lnkObject = Nothing
End Function
Private Property Set FrameWorkControl_LinkedObject(RHS As Object)
Set lnkObject = RHS
lnkObject.OnClick = "[Event Procedure]"
End Property
Private Property Get FrameWorkControl_ObjectName() As String
FrameWorkControl_ObjectName = lnkObject.Name
End Property
Private Property Get FrameWorkControl_ObjectType() As String
FrameWorkControl_ObjectType = "ComboBox"
End Property
Private Sub lnkObject_Click()
MsgBox lnkObject.Name
End Sub

FWTextBox Class:
Option Compare Database
Implements FrameWorkControl
Dim WithEvents lnkObject As TextBox
Private Function FrameWorkControl_CleanUp() As Variant
Set lnkObject = Nothing
End Function
Private Property Set FrameWorkControl_LinkedObject(RHS As Object)
Set lnkObject = RHS
lnkObject.OnClick = "[Event Procedure]"
End Property
Private Property Get FrameWorkControl_ObjectName() As String
FrameWorkControl_ObjectName = lnkObject.Name
End Property
Private Property Get FrameWorkControl_ObjectType() As String
FrameWorkControl_ObjectType = "TextBox"
End Property
Private Sub lnkObject_Click()
MsgBox lnkObject.Name
End Sub

Example Form Code:
Dim FrameWorkObjects As Collection
Private Sub Form_Load()
Dim FWObj As FrameWorkControl
Dim ctrl As Control
Dim blValidControl As Boolean
Set FrameWorkObjects = New Collection
For Each ctrl In Me.Controls
    blValidControl = False
    If TypeOf ctrl Is TextBox Then
        Set FWObj = New FWTextBox
        blValidControl = True
    End If
    If TypeOf ctrl Is ComboBox Then
        Set FWObj = New FWComboBox
        blValidControl = True
    End If
    If blValidControl Then
        Set FWObj.LinkedObject = ctrl
        FrameWorkObjects.Add FWObj, FWObj.ObjectName
        Set FWObj = Nothing
    End If
Next
End Sub



More information about the AccessD mailing list