The problem with that is that it displays "A1" or "A2" etc rather than the message.
Printable View
The problem with that is that it displays "A1" or "A2" etc rather than the message.
Put the messages into a string array and select using the i variable you're looping with:
for i = 1 to 3
textbox(i).text = strMsgArray(i)
next i
Ooops, I just realized that the A1 etc are strings, that's what threw me. That's what I get for typing without reading CAREFULLY! :-) The above would work like this:
dim A1 as string()
redim A1(3)
a1(1) = "message1"
a1(2) = "message2"
a1(3) = "message3"
for i = 1 to 3
textbox(i).text = A1(i)
next i
[This message has been edited by netSurfer (edited 01-20-2000).]
Thank you so much!!!!!!
I copied your code but It doesn't like the statement
Dim A1 as string(). It doesn't like the parenthesis after string?
oops. it's dim A1() as string
sorry about that :-)
Dim A1 as string
Dim A2 as string
Dim A3 as String
A1 = "Message1"
A2 = "Message2"
A3 = "Message3"
If I write code and I want to do something like this:
for i = 1 to 3
TextBox.caption = A & i
next
I could write it like this but it is bulky:
if i = 1 then
TextBox.caption = A1
else
if i = 2 then
TextBox.caption = A2
else
if i = 3 then
TextBox.caption = A3
End if
Endif
Endif
Any Suggestions?
for i = 1 to 3
textbox.text = "A" & i
next i
how's that?
You could also, if you're working with several text boxes instead of one, mke them a control array (all same name with different indexes). Then do this:
for i = 1 to 5
textbox(i).text = "A" & i
next i
this would in textbox(1) put A1, textbox(2) - A2 etc
[This message has been edited by netSurfer (edited 01-20-2000).]