Reputation: 135
Im getting an error at line 15, 'end of statement expected'
What am I doing wrong? Even the class whiz kid says this should work, as is:
Public Class Form1
Private Sub btnShow_Click(sender As Object, e As EventArgs) Handles btnShow.Click
Dim states() As String = IO.File.ReadAllLines("USStates.txt") ' makes array
Dim data = From state In states
Let line = state.Split(","c)
Let Name = line(0)
Let stateAb = line(1)
Let area = CInt(line(2))
Let census = CDbl(line(3))
Order By Name Ascending
' query
Select name,stateAb,area,census
*GETTING ERROR HERE***
dgvOut.DataSource = data.ToList
dgvOut.CurrentCell = Nothing
dgvOut.Columns("Name").HeaderText = "State Name"
dgvOut.Columns("ststeAb").HeaderText = "Abbreviation"
dgvOut.Columns("area").HeaderText = "Area In Sq. Miles"
dgvOut.Columns("census").HeaderText = "Population"
End Sub
End Class
Upvotes: 0
Views: 87
Reputation: 39767
Try it with line continuations:
Dim data = From state In states _
Let line = state.Split(","c) _
Let Name = line(0) _
Let stateAb = line(1) _
Let area = CInt(line(2)) _
Let census = CDbl(line(3)) _
Order By Name Ascending _
Select name, stateAb, area, census
Upvotes: 1