Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Arrays.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi you all.
I need help with arrays.I dont know what I doing wrong:(

this is the code I use to input data into an array.

dim ID(0 to 20),INCOME(0 to 20),PEOPLE(0 to 20),index as integer

For index = 0 To 20
ID(index) = Text1 ''text field one
INCOME(index) = Text2 ''text field two
PEOPLE(index) = Text3 ''text field three
Next index


After inputting now I would like take the array and output it.This is the code I use.

for index = 0 to 20
msgbox ID(index)
Next index

It doesnt work:(
Please help...
 
Are you really using the double quotes " for your comments? If so, make them single quotes:'
Also, the word index may be a reserved word. Try using something else like i
Lastly, the default property of a textbox is it's text property, but it probably doesn't hurt to explicitly state thats what you want:
Code:
ID(i) = Text1.text
 
Just a note:
with the following line the default data type is Variants
dim ID(0 to 20),INCOME(0 to 20),PEOPLE(0 to 20),index as integer

Variants are slower than Strings and are obsolete in VB.NET.
Better to use:
Dim ID(20) as string
Dim Income(20) as String
etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top