ElSmisko
asked on
Accessing data from several textboxes.
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!
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!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
I tried both your examples but I receive an error-message saying:
"Class 'WindowsApplication1.Form1
I have no idea what that means. Please help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
Me.Controls("TextBox" & i & j).Text
for it to work, but now it works. =D
Thanks for all your help guys!
for j = 1 to 9
square(i,j) = frm("TextBox" & i & j).Text
next
next