D
Dan
Is it possible to dynamically create and populate properties? Below is
my class. I would like to define properties for each of the items in my
two arrays without actually defining each one. (There are over 100 in
total). I would to have them set up the same as i have "form_id" below,
but im not sure what the syntax to do it is (without actually typing
each one).
' declare form_id
private form_id
' set get/let properties for form_id ------------------------
Public Property Get form_id()
form_id = m_form_id
End Property
Public Property Let form_id(p_Data)
m_form_id = p_Data
session("form_id") = p_Data
End Property
'
-----------------------------------------------------------------------
' below this point is where i need help
'declare the dynamic properties
private aryTableA
private aryTableB
' the values in these arrays are the field names in the db tables.
aryTableA = array("dog","cat","bird")
aryTableB = array("pizza","hamburger","hotdog")
For $i = 0 To ubound(aryTableA)
private m_ & $i ' if this can't be declared dynamically thats
ok
public property Get $i()
$i = m_ & i
end property
public property Let $i(p_Data)
m_ & $i = p_Data
end property
Next
' ------------------------------------------
' and from here, i im just not sure how to use the variable in my
update statement
public function saveChanges
...
For i = 0 to ubound(aryTableA)
strSQL = strSQL & "; UPDATE table_A set " & i & " = '" & m_ &
$i & "' WHERE form_id = " & m_form_id
....
Next
...
end function
my class. I would like to define properties for each of the items in my
two arrays without actually defining each one. (There are over 100 in
total). I would to have them set up the same as i have "form_id" below,
but im not sure what the syntax to do it is (without actually typing
each one).
' declare form_id
private form_id
' set get/let properties for form_id ------------------------
Public Property Get form_id()
form_id = m_form_id
End Property
Public Property Let form_id(p_Data)
m_form_id = p_Data
session("form_id") = p_Data
End Property
'
-----------------------------------------------------------------------
' below this point is where i need help
'declare the dynamic properties
private aryTableA
private aryTableB
' the values in these arrays are the field names in the db tables.
aryTableA = array("dog","cat","bird")
aryTableB = array("pizza","hamburger","hotdog")
For $i = 0 To ubound(aryTableA)
private m_ & $i ' if this can't be declared dynamically thats
ok
public property Get $i()
$i = m_ & i
end property
public property Let $i(p_Data)
m_ & $i = p_Data
end property
Next
' ------------------------------------------
' and from here, i im just not sure how to use the variable in my
update statement
public function saveChanges
...
For i = 0 to ubound(aryTableA)
strSQL = strSQL & "; UPDATE table_A set " & i & " = '" & m_ &
$i & "' WHERE form_id = " & m_form_id
....
Next
...
end function