G
Guest
I have a class that has responses to a survey. Some questions have text
answers, and some have enum answers (integer type). All have ResponseIDs.
If I'm passed data in random order of responseIDs, is there a way to access
the right member within the class?
Public Structure TextResponse
Public RespID As Integer
Public Text As String
End Structure
Public Class AssessmentCls
Private _Q001 As Integer = Q001resp.No
Public Enum Q001resp As Integer
Yes = 1
No = 5
End Enum
Public Property Q001() As Q001resp
Get
Return _Q001
End Get
Set(ByVal Value As Q001resp)
_Q001 = Value
End Set
End Property
Public Enum Q005resp As Integer
FreeFormText = 6
End Enum
Private _Q005 As TextResponse
Public Property Q005() As String
Get
Return _Q005.Text
End Get
Set(ByVal Value As String)
_Q005.Text = Value
_Q005.RespID = Q005resp.FreeFormText
End Set
End Property
Lets say that the first responseID I get is 6. That means that the data is
for _Q005.
Is there some way I can set up a hashtable or something like that for the
class, so that I can get directly to _Q005 rather than having to search
through the class to find a match on ResponseID of 6?
answers, and some have enum answers (integer type). All have ResponseIDs.
If I'm passed data in random order of responseIDs, is there a way to access
the right member within the class?
Public Structure TextResponse
Public RespID As Integer
Public Text As String
End Structure
Public Class AssessmentCls
Private _Q001 As Integer = Q001resp.No
Public Enum Q001resp As Integer
Yes = 1
No = 5
End Enum
Public Property Q001() As Q001resp
Get
Return _Q001
End Get
Set(ByVal Value As Q001resp)
_Q001 = Value
End Set
End Property
Public Enum Q005resp As Integer
FreeFormText = 6
End Enum
Private _Q005 As TextResponse
Public Property Q005() As String
Get
Return _Q005.Text
End Get
Set(ByVal Value As String)
_Q005.Text = Value
_Q005.RespID = Q005resp.FreeFormText
End Set
End Property
Lets say that the first responseID I get is 6. That means that the data is
for _Q005.
Is there some way I can set up a hashtable or something like that for the
class, so that I can get directly to _Q005 rather than having to search
through the class to find a match on ResponseID of 6?