how to calculate the distence ?

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 3
Reputation: shinchan is an unknown quantity at this point 
Solved Threads: 0
shinchan shinchan is offline Offline
Newbie Poster

how to calculate the distence ?

 
0
  #1
Jan 30th, 2008
im doin my final year project nw..its abt map...how i want to calculate distence between 2 points by clicking on that point1 and drag until another point2.
i realy dun hv idea to do..realy need help from your guyz..thank you
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: how to calculate the distence ?

 
0
  #2
Jan 30th, 2008
You'll need to track mouse down and mouse up events, then use the Pythagorean theorem.

Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3
Reputation: shinchan is an unknown quantity at this point 
Solved Threads: 0
shinchan shinchan is offline Offline
Newbie Poster

Re: how to calculate the distence ?

 
0
  #3
Feb 14th, 2008
ya..but i dont know to make it in vb..
can give example code ..?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3
Reputation: shinchan is an unknown quantity at this point 
Solved Threads: 0
shinchan shinchan is offline Offline
Newbie Poster

Re: how to calculate the distence ?

 
0
  #4
Feb 14th, 2008
Originally Posted by shinchan View Post
im doin my final year project nw..its abt map...how i want to calculate distence between 2 points by clicking on that point1 and drag until another point2.
i realy dun hv idea to do..realy need help from your guyz..thank you
can help me in the coding by giving example coding.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: how to calculate the distence ?

 
0
  #5
Feb 14th, 2008
No, shinchan, we won't do your homework for you. If your professor has asked you to do something with tools he has not taught you, go see the department chair or the ombudsman. Otherwise, if you haven't paid enough attention in class to pass the assignment then you are going to fail it. Sorry.

If you try to do it, and post here with what you have got, and where it goes wrong, etc. we will help you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 43
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: how to calculate the distence ?

 
0
  #6
Feb 16th, 2008
Count me in Duoas, yeah he didn't even give a try...
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 43
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: how to calculate the distence ?

 
0
  #7
Feb 16th, 2008
Count me in Duoas, yeah he didn't even give a try...
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,134
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: how to calculate the distence ?

 
0
  #8
Feb 18th, 2008
try to use this sample code

  1. Public Function DistanceBetween(ByVal X1 As Single, ByVal Y1 As Single, ByVal X2 As Single, ByVal Y2 As Single) As Single
  2. ' Calculate the distance between two points, given their X/Y coordinates.
  3.  
  4. ' The short version...
  5. DistanceBetween = Sqr((Abs(X2 - X1) ^ 2) + (Abs(Y2 - Y1) ^ 2))
  6.  
  7. ' The longer version, to illustrate how it works...
  8. Dim Horizontal As Single, Vertical As Single
  9. Horizontal = Abs(X2 - X1)
  10. Vertical = Abs(Y2 - Y1)
  11. DistanceBetween = Sqr((Horizontal * Horizontal) + (Vertical * Vertical))
  12. End Function
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC