Sub btnOK_click
Dim crd()
'This is so all of the points in the file will list when the text box is empty
Dim reader As TextReader
reader.Initialize (File.openinput(File.DirInternal,main.strfilename ))
Dim lineoftext As String
Dim cline()
lineoftext=reader.ReadLine
Do While lineoftext<>Null
cline=Regex.Split (",",lineoftext)
txtdisplay.text=txtdisplay.text & cline(0) & " " & NumberFormat(cline(1),0,3) & " " & NumberFormat(cline(2),0,3) & " " & cline(3) & CRLF
lineoftext=reader.readline
Loop
reader.Close
End If
'when there is a range of points separated with a comma
Dim firstpt,lastpt,crd()
Dim reader As TextReader
reader.Initialize (File.openinput(File.DirInternal,main.strfilename ))
Dim lineoftext As String
Dim cline()
crd=Regex.Split(",",txtrange.Text )
firstpt=crd(0)
lastpt=crd(1)
lineoftext=reader.ReadLine
Do While lineoftext<>Null
cline=Regex.Split(",",lineoftext )
If cline(0)>=firstpt AND cline(0)<=lastpt Then
txtdisplay.Text = txtdisplay.Text & cline(0) & " " & NumberFormat(cline(1),0,3) & " " & NumberFormat(cline(2),0,3) & " " & cline(3) & CRLF
End If
lineoftext=reader.readline
Loop
reader.Close
End Sub