By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,543 Members | 2,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,543 IT Pros & Developers. It's quick & easy.

Loop issues for textboxs with variables

P: 21
I have 27 textboxes and am wishing to cycle through them using a do... loop.
this code doesn't work:

N = 1
Do
textbox(N).text = someStringArray(N-1)
N = N + 1
loop until N = 27

brings up a compile error: sub or function not defined

it doesn't like &, +, () and []. nothing works.

any suggestions?

cheers. Black Box
Oct 22 '06 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
N = 1
Do until N = 27
control("textbox" & N).text = someStringArray(N-1)
N = N + 1
loop


I have 27 textboxes and am wishing to cycle through them using a do... loop.

this code doesn't work:

N = 1
Do
textbox(N).text = someStringArray(N-1)
N = N + 1
loop until N = 27

brings up a compile error: sub or function not defined

it doesn't like &, +, () and []. nothing works.

any suggestions?

cheers. Black Box
Oct 22 '06 #2

Expert 5K+
P: 8,434
N = 1
Do until N = 27
control("textbox" & N).text = someStringArray(N-1)
N = N + 1
loop
I'd just like to point out, the original code might work if the text boxes are a control array. Which I believe is generally considered more efficient anyway.
Oct 23 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
You're probably right.



I'd just like to point out, the original code might work if the text boxes are a control array. Which I believe is generally considered more efficient anyway.
Oct 23 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.