Problem with Types
Posted: Fri Oct 26, 2012 3:20 pm
Hello, I have the following code, but does not work as I want
Will you help me with this please?
This is the source code:
I created five instances for the type USERS. Instances are names of people. Then when you press a key displays the list of instances. Then again I press a key and sixth instance is created, which has the name "Ralph". Finally, with the instruction "Insert", I need to position the new instance in the second position, and for that I use "Insert us, After (First (USERS))". However, the instance is positioned in the third position, and not the second! Why is this?
Thanks for your help friends
Will you help me with this please?
This is the source code:
Code: Select all
'Define Type
Type USERS
Field name As String
EndType
'Create five instances
us.USERS = New(USERS)
us\name= "John"
us.USERS = New(USERS)
us\name= "Michael"
us.USERS = New(USERS)
us\name= "Peter"
us.USERS = New(USERS)
us\name= "Jason"
us.USERS = New(USERS)
us\name= "Charlie"
'Read information of instances
For us = Each USERS
Print us\name
Next us
'Press any key
WaitKey
'Empty space
Print " "
'Create new instance and insert in second position
us.USERS = New(USERS)
us\name= "Ralph"
Insert us, After(First(USERS))
'Read information of instances with new change
For us = Each USERS
Print us\name
Next us
'Press any key to exit program
WaitKey
Thanks for your help friends