Loop through text box array

I need to grab the values from several text boxes on several tabs (sstab).
I 'have' to grab them in order, at least a certain order...
They're laid out as such:

A  B
A  B
A  B

on each tab.

I'm writing these values to the registry, so A's value is going to be B, so I don't think a for/each would work here...
I 'thought' about adding a Tag to each "A" and/or each "B", but I'm wondering if there's a more effecient way.

For X = 0 To sstMain.Tabs - 1
   'Saves the Tab's caption as the section, then I need to save each txtData(y) with a value of txtData(y+1) (these are created in sequence,
   'starting at array 2, so all 'even' txtboxes would be the Key, and all odd's (above 1), would be the value).
 SaveSetting strAppName, "Settings\" & sstMain.TabCaption(X), txtData(y).Text, txtData(y+1).Text
Next X

Thanx!
LVL 67
sirbountyAsked:
Who is Participating?
 
ShauliCommented:
Trim trim... Vroom vroom...

I think you dont need to loop among the tabs, just among the txtData boxes, maybe something like:

For y = 0 To txtData.Count -1
   If y Mod 2 <> 0 then
       SaveSetting strAppName, "Settings\" & txtData(y).Tag, txtData(y-1).Text, txtData(y).Text
   End If
Next y

Or am I too drunk?  :)

S
0
 
sirbountyAuthor Commented:
I believe you've got it. :^)

But, I think I'm rethinking this portion of the project -it's getting me into places that, while they seem to work fine now, may prove more of a headache later...

I'm quite certain this is the solution though - so thank you - points are yours (go spend 'em on a chainsaw! haha)
0
 
ShauliCommented:
Chainsaw it is, thanks :)

S
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.