All pastes #478040 Raw Edit

Something

public text v1 · immutable
·published 2007-05-08 23:37 UTC
rendered paste body
Public Class Form1

    Structure Data
        Dim model As String
        Dim gallons As Double
    End Structure

    Structure Data1
        Dim model As String
        Dim number As Double
        Dim gallons As Double
    End Structure

    Dim fileData(11) As Data
    Dim modelData(4) As Data1
    Dim FILE_NAME As String = "MILEAGE.TXT"

    Private Sub retrieveData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles retrieveData.Click
        Dim readFile As IO.StreamReader = IO.File.OpenText(FILE_NAME)
        Dim fieldData() As String
        Dim n As Integer
        n = 0
        Do While (readFile.Peek <> -1)
            fieldData = readFile.ReadLine.Split(","c)
            fileData(n).model = fieldData(0).Trim
            fileData(n).gallons = fieldData(1).Trim
            n += 1
        Loop

    End Sub

End Class