G
Greg
I have the following class as such.
Class EmployeeClass
Private m_FirstName as string
Public Property FirstName () as String
Get
Return m_FirstName
End Get
Set(ByVal Value as String)
m_FirstName = Value
End Set
End Class
In my code I want to setup an array containing this class object. So I do
the following.
dim objEmployee(2) as EmployeeClass
objEmployee(0) = New EmployeeClass
objEmployee(0).FirstName = "Greg"
objEmployee(1) = New EmployeeClass
objEmployee(1).FirstName = "John"
Now, I have two employees in this EmployeeClass object and I am going to
pass it to a function for the Employee's in the object to be inserted into my
database. So, I do it like this.
Function InsertEmployee(byval objEmployee as EmployeeClass) as boolean
' Step through each Employee record and append to database.
End Function
I would pass my EmployeeClass object like this, InsertEmployee(objEmployee).
Now, I want to do a few things inside this funciton.
1. How can I find out how many Employee records exist.
2. How can Determine which properties exist in this class. For example, in
my case I have the FirstName property, but if I did not know what it was, how
could I step through each property.
3. And, lastly, as I determine each property above, how could I determine
what type of property each is.
Maybe once I understand how to do this I might be able to do what I want.
What I have done in the past is create one single save rountine that can
save data to all of my tables through one single utility. Maybe if I can get
this part worked out, i might be able to build one common Save utility.
Thanks.
Class EmployeeClass
Private m_FirstName as string
Public Property FirstName () as String
Get
Return m_FirstName
End Get
Set(ByVal Value as String)
m_FirstName = Value
End Set
End Class
In my code I want to setup an array containing this class object. So I do
the following.
dim objEmployee(2) as EmployeeClass
objEmployee(0) = New EmployeeClass
objEmployee(0).FirstName = "Greg"
objEmployee(1) = New EmployeeClass
objEmployee(1).FirstName = "John"
Now, I have two employees in this EmployeeClass object and I am going to
pass it to a function for the Employee's in the object to be inserted into my
database. So, I do it like this.
Function InsertEmployee(byval objEmployee as EmployeeClass) as boolean
' Step through each Employee record and append to database.
End Function
I would pass my EmployeeClass object like this, InsertEmployee(objEmployee).
Now, I want to do a few things inside this funciton.
1. How can I find out how many Employee records exist.
2. How can Determine which properties exist in this class. For example, in
my case I have the FirstName property, but if I did not know what it was, how
could I step through each property.
3. And, lastly, as I determine each property above, how could I determine
what type of property each is.
Maybe once I understand how to do this I might be able to do what I want.
What I have done in the past is create one single save rountine that can
save data to all of my tables through one single utility. Maybe if I can get
this part worked out, i might be able to build one common Save utility.
Thanks.