home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmDist
- Caption = "Intercity Distances"
- ClientHeight = 2325
- ClientLeft = 2580
- ClientTop = 1590
- ClientWidth = 4335
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 2325
- ScaleWidth = 4335
- Begin VB.PictureBox picMiles
- Height = 255
- Left = 840
- ScaleHeight = 195
- ScaleWidth = 2595
- TabIndex = 9
- Top = 1800
- Width = 2655
- End
- Begin VB.CommandButton cmdShow
- Caption = "Show Mileage between Origin and Destination"
- Height = 495
- Left = 120
- TabIndex = 8
- Top = 1200
- Width = 4095
- End
- Begin VB.TextBox txtDest
- Height = 285
- Left = 3360
- TabIndex = 7
- Top = 720
- Width = 375
- End
- Begin VB.TextBox txtOrig
- Height = 285
- Left = 3360
- TabIndex = 5
- Top = 360
- Width = 375
- End
- Begin VB.Label lblPh
- Caption = "4. Philadelphia"
- Height = 255
- Left = 360
- TabIndex = 3
- Top = 840
- Width = 1335
- End
- Begin VB.Label lblNY
- Caption = "3. New York"
- Height = 255
- Left = 360
- TabIndex = 2
- Top = 600
- Width = 1335
- End
- Begin VB.Label lblLA
- Caption = "2. Los Angeles"
- Height = 255
- Left = 360
- TabIndex = 1
- Top = 360
- Width = 1335
- End
- Begin VB.Label lblCh
- Caption = "1. Chicago"
- Height = 255
- Left = 360
- TabIndex = 0
- Top = 120
- Width = 1335
- End
- Begin VB.Label lblDest
- Alignment = 1 'Right Justify
- Caption = "Destination"
- Height = 255
- Left = 2160
- TabIndex = 6
- Top = 720
- Width = 1095
- End
- Begin VB.Label lblOrig
- Alignment = 1 'Right Justify
- Caption = "Origin"
- Height = 255
- Left = 2160
- TabIndex = 4
- Top = 360
- Width = 1095
- End
- Attribute VB_Name = "frmDist"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim rm(1 To 4, 1 To 4) As Single
- Private Sub cmdShow_Click()
- Dim row As Integer, col As Integer
- 'Determine road mileage between cities
- row = Val(txtOrig.Text)
- col = Val(txtDest.Text)
- If (row >= 1 And row <= 4) And (col >= 1 And col <= 4) Then
- Call ShowMileage(rm(), row, col)
- Else
- MsgBox "Origin and Destination must be numbers from 1 to 4", , "Error"
- End If
- txtOrig.SetFocus
- End Sub
- Private Sub Form_Load()
- Dim row As Integer, col As Integer
- 'Fill two-dimensional array with intercity mileages
- 'Assume the data has been placed in the file "DISTANCE.TXT"
- '(First line of the file is 0, 2054, 802, 738)
- Open App.Path & "\DISTANCE.TXT" For Input As #1
- For row = 1 To 4
- For col = 1 To 4
- Input #1, rm(row, col)
- Next col
- Next row
- Close #1
- End Sub
- Private Sub ShowMileage(rm() As Single, row As Integer, col As Integer)
- 'Display mileage between cities
- picMiles.Cls
- picMiles.Print "The road mileage is"; rm(row, col)
- End Sub
-