borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Need some help) New Topic New Poll Post Reply
AndreaVB Forum : VB General : MILAGE CALCULATOR
Poster Message
mrcoolcurrent
Level: Big Cheese

Registered: 19-01-2007
Posts: 21

icon MILAGE CALCULATOR

I want to create a milage calculator that would calculate distances between Aspen, Boston,London, Paris, Cairo and Lagos.

I know the distances between all the location.But how do I create a data table that the program could read where the names of any two towns meet??

30-05-2007 at 04:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 532
icon Re: MILAGE CALCULATOR

I'd do this by creating two tables:

one with ID and CityName

the second with

IDCity1 IDCity2 Distance

you can fill table1 with an autoincremental ID and then the city name, i.e.

1 Aspen
2 Boston
3 London
4 Paris
5 Cairo
6 Lagos

thn fill the second with the IDs of the two cities and the distances, maybe without duplicating then, i.e.

1 2 [distance between Aspen and Boston]
1 3 [distance between Aspen and London]
[...]

there is no need to have in the table the distance between Boston and Aspen because you already have distance from Aspen to Boston as a convention you can always put the lower id on the first column and the higher on the second.
and also there is no need for a record with distance between Aspen and Aspen (it is 0)

hope this helps

____________________________
AndreaVB

31-05-2007 at 06:39 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
mrcoolcurrent
Level: Big Cheese

Registered: 19-01-2007
Posts: 21
icon Re: MILAGE CALCULATOR

1 ASPEN
2 120 BOSTON
3 450 1250 LONDON
4 987 600 125 PARIS
5 750 1547 578 244    CAIRO

If you look at the tableabove the distance between aspe to aspen is 0. Boston to Aspen is 120, London to Aspen is 450, Paris to aspen is 987 and Cairo to aspen is 750.

My question is how do I run this program in Vb.

31-05-2007 at 08:17 AM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 918
icon Re: MILAGE CALCULATOR

Hello. You spoke about a calculator, but now you say you already stored some distances in a table. So, what help do you need? Do you need help on database intefacing you application? Or rather do you need help on calculate any new distance?

Two or three years ago I developed a small app for a forum user here (if you want to have a look to the topic, you can search fo "Orthodromic distance"), but its goal was to calculate the distance between two points on Earth surface. Is your goal to build a similar application?

Or is your goal more similar to executing a query in the table to return the requested row values, and managing the table add/edit/delete/sort procedures?

Let us know.

____________________________
Real Programmer can count up to 1024 on his fingers

31-05-2007 at 12:03 PM
View Profile Send Email to User Show All Posts | Quote Reply
mrcoolcurrent
Level: Big Cheese

Registered: 19-01-2007
Posts: 21
icon Re: MILAGE CALCULATOR

Thank you for your responses. I am trying to build an application for my office that would enable people travelling on officially compute the actual miles they are covering.

What I want to do is to build an application that would interface with a table and compute total distance.

31-05-2007 at 04:13 PM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 918
icon Re: MILAGE CALCULATOR

... so I guess you have the need to manually input the mileages into the db, and after retrieved each one, keep a sum and update it time by time. Am I correct?

If so, I argue you need help on db interfacing. So I suggest you to have a look at a sample project of mine (you can download it by this link), and search for sample code pieces in the Database section of the forum.

Otherwise, ask exactly what help you need.
Hope it helps.

____________________________
Real Programmer can count up to 1024 on his fingers

01-06-2007 at 06:29 AM
View Profile Send Email to User Show All Posts | Quote Reply
mrcoolcurrent
Level: Big Cheese

Registered: 19-01-2007
Posts: 21
icon Re: MILAGE CALCULATOR

I was thinking of using array like a matrix of arrays and each city would be a variable. I would have a look up table that would compare the variables (cities) I selected and return a result.
Got it?

01-06-2007 at 06:37 AM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 918
icon Re: MILAGE CALCULATOR

quote:
mrcoolcurrent wrote:Got it?
Not much.
Try drawing what you wat to obtain, post the draw and let's see.


____________________________
Real Programmer can count up to 1024 on his fingers
01-06-2007 at 11:23 AM
View Profile Send Email to User Show All Posts | Quote Reply
mrcoolcurrent
Level: Big Cheese

Registered: 19-01-2007
Posts: 21
icon Milage calculator

Pls. I need help .
I want to make milage calculator to compute the distances between all the EU Nations.

I have the list of the countries and the distances.

I need an idea pls.

10-12-2007 at 08:48 PM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 923
icon Re: MILAGE CALCULATOR

Merged this topic

____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

31-12-2007 at 08:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : MILAGE CALCULATOR
Next Topic (Need some help) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder