Help w/ 1st File Access Program

  • Thread starter Thread starter Confessor
  • Start date Start date
C

Confessor

[Ellipses added to defeat word wrapping, improve readability]

Public Class Form1
Inherits System.Windows.Forms.Form
Structure PointTemplate
Dim Latitude As Single
Dim Longitude As Single
Dim Elevation As Integer
End Structure
Dim MaxPoint As Integer
Dim Point() As PointTemplate
[Windows Form Designer Generated Code]
Private Sub Form1_Load(...) Handles MyBase.Load
If System.IO.File.Exists("C:\...\points.dat") = True Then
System.IO.File.OpenRead("C:\...\points.dat")
Else
System.IO.File.Create("...\points.dat")
End If
End Sub
End Class

I'm hoping to store a persistent collection of points on the Earth's
surface (defined by Lat, Long, and Elevation), reading the data from and
writing to a file. Points read from the file will be stored in the Point()
array.

The best logical way to read data from the file into the array would seem
to be as follows, if you can forgive my lack of proper understanding of
file access commands.

For T = 1 to MaxPoint
Read [line beginning with T] into Point(T).[variables]
Next

MaxPoint would of course, be stored in the file as well, probably at the
beginning.

Am I missing only exact syntax, or is my understanding of file access in
need of a paradigm shift?

Any help with either would be appreciated.

Thanks to everybody in advance,
Confessor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top