home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Begin VB.Form frmCosts
- BackColor = &H00C0C0C0&
- Caption = "Average Expenses of Commuter Students (1995-96)"
- ClientHeight = 2535
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 6945
- ForeColor = &H00000000&
- LinkTopic = "Form1"
- ScaleHeight = 2535
- ScaleWidth = 6945
- StartUpPosition = 3 'Windows Default
- Begin MSFlexGridLib.MSFlexGrid msgCosts
- Height = 2535
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 6735
- _ExtentX = 11880
- _ExtentY = 4471
- _Version = 393216
- Rows = 9
- Cols = 5
- FixedRows = 0
- FixedCols = 0
- ForeColor = 0
- GridLines = 0
- ScrollBars = 0
- BorderStyle = 0
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Courier New"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Attribute VB_Name = "frmCosts"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Form_Load()
- Dim rowNum As Integer, colNum As Integer
- Dim strData As String, numData As Single
- 'Columns headings
- msgCosts.Row = 0
- msgCosts.Col = 1
- msgCosts.Text = "Pb 2-yr"
- msgCosts.Col = 2
- msgCosts.Text = "Pr 2-yr"
- msgCosts.Col = 3
- msgCosts.Text = "Pb 4-yr"
- msgCosts.Col = 4
- msgCosts.Text = "Pr 4-yr"
- 'Read data from data file and obtain column totals
- Dim total(1 To 4) As Single
- Open App.Path & "\STCOSTS.TXT" For Input As #1
- For rowNum = 2 To 6 'row 0 is titles, row 1 is blank
- For colNum = 0 To 4
- msgCosts.Row = rowNum
- msgCosts.Col = colNum
- If colNum = 0 Then
- Input #1, strData
- msgCosts.Text = strData
- Else
- Input #1, numData
- msgCosts.Text = FormatCurrency(numData, 0)
- total(colNum) = total(colNum) + numData
- End If
- Next colNum
- Next rowNum
- 'Display totals
- msgCosts.Row = 8
- msgCosts.Col = 0
- msgCosts.Text = "Total"
- For colNum = 1 To 4
- msgCosts.Col = colNum
- msgCosts.Row = 7
- msgCosts.Text = "-------"
- msgCosts.Row = 8
- msgCosts.Text = FormatCurrency(total(colNum), 0)
- Next colNum
- 'Set column widths to accomodate data; right-justify dollar amounts
- msgCosts.ColWidth(0) = 2000 'Space for category names
- msgCosts.ColAlignment(0) = 1 'Left alignment
- For colNum = 1 To 4
- msgCosts.ColWidth(colNum) = 1200 'Space for dollar amounts
- msgCosts.ColAlignment(colNum) = 7 'Right alignment
- Next colNum
- 'Set overall grid size to minimum needed for the data
- msgCosts.Width = 2000 + 4 * 1200
- msgCosts.Height = 9 * msgCosts.RowHeight(0)
- End Sub
-