D
dcs
Hi,
Can someone please help. I have a class that contains the following
Structure (called MyStructure) and sub (called MainSub). And this 1st
class inherits a 2nd class that contains a sub called
Get_Values_From_MyStructure. My problem is in sub
Get_Values_From_MyStructure. Since Get_Values_From_MyStructure is
inherited by many different classes, its parameter i_obj_Structure will
contain various Structure definitions. And thats a problem when using
GetType(). I have tried substitutng the code GetType(i_obj_Structure)
in place of GetType(MyStructure) but it didn't work. PLEASE HELP. Thank
you VERY much
-Doug
Public Structure MyStructure
Public Field1 As String
Public Field2 As Boolean
End Structure 'MyStructure
Public Sub MainSub
Dim l_MyStructure As New MyStructure 'Local Structure
l_MyStructure.Field1 = "AA"
l_MyStructure.Field2 = True
Call Get_Values_From_MyStructure(l_MyStructure)
End Sub 'MainSub
Private Sub Get_Values_From_MyStructure (ByVal i_obj_Structure As
Object)
'-------------------------------------------------------
'-- This works. But Instead of hardcoding MyStructure
'-- in the GetType(MyStructure), I need to have the
'-- structure type that is passed in the parameter
'-- i_obj_Structure, since MyStructure willnot always
'-- be used.
'-------------------------------------------------------
Dim l_FieldInfo As Reflection.FieldInfo =
GetType(MyStructure).GetField("Field1")
MsgBox("Get value:" & l_FieldInfo.GetValue(i_obj_Structure))
End Sub 'Get_Values_From_Record 'Get_Values_From_Structure
Can someone please help. I have a class that contains the following
Structure (called MyStructure) and sub (called MainSub). And this 1st
class inherits a 2nd class that contains a sub called
Get_Values_From_MyStructure. My problem is in sub
Get_Values_From_MyStructure. Since Get_Values_From_MyStructure is
inherited by many different classes, its parameter i_obj_Structure will
contain various Structure definitions. And thats a problem when using
GetType(). I have tried substitutng the code GetType(i_obj_Structure)
in place of GetType(MyStructure) but it didn't work. PLEASE HELP. Thank
you VERY much
-Doug
Public Structure MyStructure
Public Field1 As String
Public Field2 As Boolean
End Structure 'MyStructure
Public Sub MainSub
Dim l_MyStructure As New MyStructure 'Local Structure
l_MyStructure.Field1 = "AA"
l_MyStructure.Field2 = True
Call Get_Values_From_MyStructure(l_MyStructure)
End Sub 'MainSub
Private Sub Get_Values_From_MyStructure (ByVal i_obj_Structure As
Object)
'-------------------------------------------------------
'-- This works. But Instead of hardcoding MyStructure
'-- in the GetType(MyStructure), I need to have the
'-- structure type that is passed in the parameter
'-- i_obj_Structure, since MyStructure willnot always
'-- be used.
'-------------------------------------------------------
Dim l_FieldInfo As Reflection.FieldInfo =
GetType(MyStructure).GetField("Field1")
MsgBox("Get value:" & l_FieldInfo.GetValue(i_obj_Structure))
End Sub 'Get_Values_From_Record 'Get_Values_From_Structure