PDA

Click to See Complete Forum and Search --> : Please help****Listindex & arrays


SMDillon
Nov 15th, 1999, 11:33 AM
Hi guys,
I'm (unsucessfully) trying to create and populate a 2 dinensional array to store distances between two places.
I am then trying to use two list boxes to choose the start and end point of the journey. I cannot seem to get the listindex property to find the appropiate distance in the array. If anyone out there could help .....I would really appreciate it.
Cheers
Steven

Jessie
Nov 15th, 1999, 12:16 PM
almost sounds similar to a problem i had two days ago
go back to page three of the topic list
look for a topic aaron young Recombolistindex
Topic Starter Jessie
Posted 11-14-1999 09:44pm
read both parts of the subject i not sure this will help but you never know it worked for me

SMDillon
Nov 15th, 1999, 01:27 PM
Jessie,
Thanks for the help, I am currently looking at the info.
Cheers

Serge
Nov 15th, 1999, 05:59 PM
Are you trying to populate the array from 2 listboxes? Or you're trying to read the values from the array?

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

SMDillon
Nov 16th, 1999, 04:48 AM
Serge,
I'm trying to read my values from the array so that in list1/cbo1 there is alreay entires like London and list2/cbo2 will contain destination eg Paris, and the distance between the two (already loaded by the program in the array) will be displayed.
Cheers

Serge
Nov 16th, 1999, 08:31 AM
How do you have those values in the array (i.e. do you have them as string like "London", Paris" etc)??? or do you actually save the position (ListIndex) of the item?


Regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

SMDillon
Nov 16th, 1999, 09:34 AM
Serge,

I'm trying to save the position (lstIndex) of the item

Serge
Nov 16th, 1999, 06:03 PM
So my guess, you save those indexes like this arrYourArray(0,0) would have value lets say 1 (London in first Listbox), but what's the value for the second Listbox arrMyArray(0,1)?

I think in this situation you better create a User Defined Datatype:


Private Type utTravel
iStart As Integer
iDestination As Integer
End Type

'----Then here you would declare your array of this user defined type:
Private tTravel(5) As utTravel


'-----Then lets say you want to select items in the Listboxes for the array element 2

List1.ListIndex = tTravel(2).iStart
List2.ListIndex = tTravel(2).iDestination



Whew, I hope I didn't confuse you that much.

Regards,


------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)



[This message has been edited by Serge (edited 11-17-1999).]

Chris Perrin
Nov 18th, 1999, 02:28 AM
One thing that always gets me when I use ListBoxes and ComboBoxes with arrays is that I forget that ListBoxes are always zero-based while arrays do not have to be.

SMDillon
Nov 18th, 1999, 11:40 AM
Super,I'll give it a try, cheers mate