Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Arrays And List Boxes


2 replies to this topic

#1 tobimichigan

    Newbie

  • Kontributors
  • Pip
  • 2 posts

Posted 21 June 2008 - 12:22 PM

Hello Guys,

I am working on an application. It is such that there are 2 list boxes or combo boxes. One is Labeled Departure and the other is labeled Destination. The boxes contain various states in America and each state has its unique feature of distances. The difference of the distances has to be reflected on a label.
Where I need help is a code to execute the contents of the array into values For instance:

Option Explicit

Private Type Stateinfo
statedeparture as integer
stateDestination as integer
TotalDistance as integer
End Type
Dim StateDistance (10, 20) as stateinfo

How do I code the list-boxes to display the Form_Load values in a label?
Hope to hear from you soon.
TM

#2 Galahad

    Neurotical Squirrel

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 590 posts
  • Gender:Male
  • Location:Novi Sad, Vojvodina
  • Interests:Programming, Hardcore dance/Trance/House music. Girls, girls and more girls ;) ... In short, everything youg people like, I like :D Oh yeah, and dont't forget politics :)
  • myCENT:48.25

Posted 21 June 2008 - 07:15 PM

Ok, you're going to have to be much clearer than this...

If I understand you correctly, you want a certain label to show distance between two destinations? The easiest way would be to have the distances encoded in a matrix, and just pull the stiff from it... For example, distance between state 1 and state 8 is 100.... So, array Distances(1,8) = 100.... And so on... Get the idea?

I just assumed this is what you want, if not, explain a little further and maybe I'll be able to help...

#3 minimcmonkey

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 414 posts
  • Gender:Male
  • Location:United Kingdom
  • myCENT:62.89

Posted 23 June 2008 - 09:05 PM

I havent done a lot of VB recently, but i use to use it a lot.
I would recoment for a smaller list, just have a list of distances between each desination, and departure.
you should probably plan that out first, by making a table like

# 1 2 3
_____
1|0 2 7
2|2 0 9
3|7 9 0




- some of the maths might not work in that above - i wasnt really thinking.

If there are lots of locations, you might have to use a graphical or grid appoach - i have never really used that before, so im not sure how you would do it. But just a list of distances would be the easiest method by far!

Edited by minimcmonkey, 23 June 2008 - 09:08 PM.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users