|
-
May 15th, 2002, 11:41 AM
#1
Thread Starter
Junior Member
Data records
I've got map where is possible measure the distamce betwen places and this works fine. The only thing I don't know how to do it is keeping data. Every time when distance between two places is shown in text box I want an opiton to save that data so when next time user choose the same places would be able to see this.
basically, places on the map are alsp in two combo boxes.
When one place is clicked in first com. box and second in second com. box I want the distance to be automatically shown in text box as it is when user drag the line btween places on the map....
Here is my code:
Private Sub picUk_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Line1.X1 = x
Line1.Y1 = y
Text1 = x
Text2 = y
If x > 514 And x < 529 And y > 454 And y < 466 Then
Label1.Caption = "Leicester"
End If
If x > 569 And x < 584 And y > 528 And y < 544 Then
Label1.Caption = "London"
End If
.......
Private Sub picUk_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Text3 = Text1
Text4 = Text2
d = Sqr(((Line1.X2 - Line1.X1) ^ 2) + ((Line1.Y2 - Line1.Y1) ^ 2))
txtMiles = d
txtKm = d * 1.6129
If x > 514 And x < 529 And y > 454 And y < 466 Then
Label2.Caption = "Leicester"
MsgBox ("Do you want to save this distance"), vbYesNo
End If
If x > 569 And x < 584 And y > 528 And y < 544 Then
Label2.Caption = "London"
End If
.....
Private Sub Form_Load()
With Combo1
.AddItem "Aberdeen"
.AddItem "Aberystwyth"
.AddItem "Amiens(France)"
.AddItem "Antrim"
.AddItem "Arbroath"
With Combo2
.AddItem "Aberdeen"
.AddItem "Aberystwyth"
.AddItem "Amiens(France)"
.AddItem "Antrim"
.AddItem "Arbroath"
.........
Sub Combo1_Change()
Combo1_Click
End Sub
Private Sub Combo1_Click()
Label1.Caption = Combo1.List(Combo1.ListIndex)
MsgBox "You selected: " & Combo1.Text, vbDefaultButton1
Line1.Visible = False
End Sub
Sub Combo2_Change()
Combo2_Click
End Sub
Private Sub Combo2_Click()
Label2.Caption = Combo2.List(Combo2.ListIndex)
MsgBox "You selected: " & Combo2.Text, vbDefaultButton1
Line1.Visible = False
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|