Loop through text box array

Posted on 2006-05-12
Medium Priority
Last Modified: 2010-05-01
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

Question by:sirbounty
  • 2
LVL 19

Accepted Solution

Shauli earned 1400 total points
ID: 16672195
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?  :)

LVL 67

Author Comment

ID: 16672224
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)
LVL 19

Expert Comment

ID: 16672231
Chainsaw it is, thanks :)


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question