R
Roger Lord
I am constructing a string in my program and then trying to use
it to get the value of an integer variable whose label looks like
that string. I can't figure out how to do it. For example:
Dim aXYZ As Integer = 5
Dim myString As String
Dim myResults As Integer
myString = "aXYZ"
myResults = SomeFunction?(myString)
What I want is for myResults to equal 5 using "SomeFunction?" as
shown above. How do I do that?
In actuality, I have a large dataset (7,000 rows) where I count
the number of occurrences of approximately 100 items sprinkled
throughout the rows. I have 100 integer variables structured
similar to aXYZ in my example above. As I do my counting in the
dataset, I use the following code:
For I = 0 To cntSpring - 1
mMajor = DataSet.Tables("Spring03").Rows(I).Item("MAJOR1")
Select Case mMajor
Case "ACT" : sACT += 1
Case "AED" : sAED += 1
Case "ANP" : sANP += 1
Case "ARH" : sARH += 1
etc.
End Select
Next
....where cntSprint is the number of rows in the dataset named
"Dataset" and Spring03 is the name of one of the databases making
up the dataset.
Once I come out of the For...Next loop above, I have 100 integer
variables (e.g., sACT, sAED, etc.) that represent the
distribution of their occurrence in the dataset. In another part
of my program, I am trying to construct a string like "sACT" and
do something to it so that I get the associated integer number
that came out of the For...Next loop. I'm baffled.
Thanks
Roger
it to get the value of an integer variable whose label looks like
that string. I can't figure out how to do it. For example:
Dim aXYZ As Integer = 5
Dim myString As String
Dim myResults As Integer
myString = "aXYZ"
myResults = SomeFunction?(myString)
What I want is for myResults to equal 5 using "SomeFunction?" as
shown above. How do I do that?
In actuality, I have a large dataset (7,000 rows) where I count
the number of occurrences of approximately 100 items sprinkled
throughout the rows. I have 100 integer variables structured
similar to aXYZ in my example above. As I do my counting in the
dataset, I use the following code:
For I = 0 To cntSpring - 1
mMajor = DataSet.Tables("Spring03").Rows(I).Item("MAJOR1")
Select Case mMajor
Case "ACT" : sACT += 1
Case "AED" : sAED += 1
Case "ANP" : sANP += 1
Case "ARH" : sARH += 1
etc.
End Select
Next
....where cntSprint is the number of rows in the dataset named
"Dataset" and Spring03 is the name of one of the databases making
up the dataset.
Once I come out of the For...Next loop above, I have 100 integer
variables (e.g., sACT, sAED, etc.) that represent the
distribution of their occurrence in the dataset. In another part
of my program, I am trying to construct a string like "sACT" and
do something to it so that I get the associated integer number
that came out of the For...Next loop. I'm baffled.
Thanks
Roger