Public Class frmCities

  Private Sub frmCities_Load(ByVal sender As System.Object,
                             ByVal e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'MEGACITIESDataSet.Cities'
    'table. You can move, or remove it, as needed.
    Me.CitiesTableAdapter.Fill(Me.MegacitiesDataSet.Cities)
  End Sub

  Private Sub btnDisplay_Click(ByVal sender As System.Object,
                               ByVal e As System.EventArgs) Handles btnDisplay.Click
    Dim query1 = From city In MegacitiesDataSet.Cities _
                 Where city.country = "India" _
                 Order By city.pop2010 Descending _
                 Select city.name
    lstOutput.DataSource = query1.ToList
    lstOutput.SelectedItem = Nothing
    Dim query2 = From city In MegacitiesDataSet.Cities _
                 Where city.country = "India" _
                 Select city.pop2010
    txtTotalPop.Text = CStr(query2.Sum)
  End Sub

  Private Sub Button1_Click(ByVal sender As System.Object,
                            ByVal e As System.EventArgs)
    Me.CitiesTableAdapter.Delete("Bombay", "India", 20.1, 22)
    Me.CitiesTableAdapter.Fill(Me.MegacitiesDataSet.Cities)

  End Sub
End Class
