mrlemmer11
New Member
- Joined
- Jun 8, 2015
- Messages
- 32
Hello,
So, I know this is prob really simple to a lot of you, and I wish I had your mindset, but I am just not grasping this concept
Everytime I try to work with these I hit type mismatch or subscript mismatch errors... then on the few random occasions I change something and avoid all of those, I run into other errors when I try adding to my array. Here is what I have thus far:
This sub is supposed to keep track of my users submission for strShape and strColor. For the sake this example, lets say each time a user is presented with the question "Name a shape and it's color" then the user's shape response will by strShape and the color would be strColor. Then as they progress, they can go backwards one answer at a time to reanswer a previous question. example
allAns(0,0) = square : allAns(0,1) blue
allAns(1,0) = circle : allAns(1,1) green
allAns(2,0) = triangle : allAns(2,1) green
allAns(3,0) = oval : allAns(3,1) red
then the user realizes that they didn't want to name a circle, i want the sub to then delete one at a time the answers that led up to that question so:
allAns(3,0) = deleted : allAns(3,1) deleted
... other code runs and the i call to have allAns(2,0) and allAns(2,1) deleted
allAns(2,0) = deleted : allAns(2,1) deleted
.... other code runs and i call to have allAns(1,0) and allAns(1,1) deleted
allAns(1,0) = deleted : allAns(1,1) deleted
.....other code runs and i ask the user for a shape and color again, they respond:
allAns(1,0) = hexagon : allAns(1,1) = teal
they exit the program and at that point when i look at allAns I see:
allAns(0,0) = square : allAns(0,1) blue
allAns(1,0) = hexagon : allAns(1,1) = teal
Alrighty, so that's what I see in my head, but I can't make the code I provided above in that Sub act in this fashion.... the calls I make are the following to add:
and this to delete
Thank you in advance for any explanations on what concepts I just am not grasping :/
So, I know this is prob really simple to a lot of you, and I wish I had your mindset, but I am just not grasping this concept
Everytime I try to work with these I hit type mismatch or subscript mismatch errors... then on the few random occasions I change something and avoid all of those, I run into other errors when I try adding to my array. Here is what I have thus far:
Code:
Public Sub record(ByVal strShape As String, ByVal strColor As String, addOrDelete As Boolean)If addOrDelete = True Then
ReDim Preserve allAns(0 To a, 0 To 1)
allAns(a, 0) = strShape
allAns(a, 1) = strColor
a = a + 1
Else
If addOrDelete = False Then
a = a - 1
Else
End If
End If
End Sub
This sub is supposed to keep track of my users submission for strShape and strColor. For the sake this example, lets say each time a user is presented with the question "Name a shape and it's color" then the user's shape response will by strShape and the color would be strColor. Then as they progress, they can go backwards one answer at a time to reanswer a previous question. example
allAns(0,0) = square : allAns(0,1) blue
allAns(1,0) = circle : allAns(1,1) green
allAns(2,0) = triangle : allAns(2,1) green
allAns(3,0) = oval : allAns(3,1) red
then the user realizes that they didn't want to name a circle, i want the sub to then delete one at a time the answers that led up to that question so:
allAns(3,0) = deleted : allAns(3,1) deleted
... other code runs and the i call to have allAns(2,0) and allAns(2,1) deleted
allAns(2,0) = deleted : allAns(2,1) deleted
.... other code runs and i call to have allAns(1,0) and allAns(1,1) deleted
allAns(1,0) = deleted : allAns(1,1) deleted
.....other code runs and i ask the user for a shape and color again, they respond:
allAns(1,0) = hexagon : allAns(1,1) = teal
they exit the program and at that point when i look at allAns I see:
allAns(0,0) = square : allAns(0,1) blue
allAns(1,0) = hexagon : allAns(1,1) = teal
Alrighty, so that's what I see in my head, but I can't make the code I provided above in that Sub act in this fashion.... the calls I make are the following to add:
Code:
Call record("square", "blue", True)
and this to delete
Code:
Call record("triangle", "green", False)
Thank you in advance for any explanations on what concepts I just am not grasping :/