?
Solved

Accessing data from several textboxes.

Posted on 2006-06-26
5
Medium Priority
?
169 Views
Last Modified: 2010-04-07
Hi experts!

I have 81 textboxes in a form in a 9x9-pattern.
They are named TextBoxXY (where XY are the corresponding numbers in the 9x9-patter, for example TextBox11 is the first and TextBox99 is the last).
I need to copy data from theese boxes into an array ( square(1,1) ) but I can't make the coding effective.

As it is now it says:
square(1,1) = TextBox11
square(1,2) = TextBox12
square(1,3) = TextBox13
...
square(9,7) = TextBox97
square(9,8) = TextBox98
square(9,9) = TextBox99

This is not really efficient.
What I would like is some sort code that looks something like this:

for i = 1 to 9
   for j = 1 to 9
      square(i,j) = TextBoxij
   next
next

Thank you for your help!
0
Comment
Question by:ElSmisko
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 16986962
for i = 1 to 9
   for j = 1 to 9
      square(i,j) = frm("TextBox" & i & j).Text
   next
next
0
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 150 total points
ID: 16987024
(slight correction)

for i = 1 to 9
   for j = 1 to 9
      square(i,j) = Me("TextBox" & i & j)
   next
next
0
 

Author Comment

by:ElSmisko
ID: 16987143
Thank you for your fast reply!

I tried both your examples but I receive an error-message saying:
"Class 'WindowsApplication1.Form1' cannot be indexed because it has no default property."

I have no idea what that means. Please help.
0
 
LVL 37

Accepted Solution

by:
Harisha M G earned 300 total points
ID: 16987240
for i = 1 to 9
   for j = 1 to 9
      square(i,j) = Me.Controls("TextBox" & i & j)
   next
next
0
 

Author Comment

by:ElSmisko
ID: 16987393
I had to write
Me.Controls("TextBox" & i & j).Text
for it to work, but now it works. =D

Thanks for all your help guys!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

752 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