Results 1 to 10 of 10

Thread: Please help****Listindex & arrays

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    IRELAND
    Posts
    8

    Post

    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

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    IRELAND
    Posts
    8

    Post

    Jessie,
    Thanks for the help, I am currently looking at the info.
    Cheers

  4. #4
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Are you trying to populate the array from 2 listboxes? Or you're trying to read the values from the array?

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

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    IRELAND
    Posts
    8

    Post

    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

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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
    [email protected]
    [email protected]
    ICQ#: 51055819


  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    IRELAND
    Posts
    8

    Post

    Serge,

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

  8. #8
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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:

    Code:
    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
    [email protected]
    [email protected]
    ICQ#: 51055819



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

  9. #9
    New Member
    Join Date
    Feb 1999
    Posts
    10

    Post

    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.

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Location
    IRELAND
    Posts
    8

    Post

    Super,I'll give it a try, cheers mate

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width