Public Class frmCountries

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

  Private Sub btnDisplay_Click(ByVal sender As System.Object,
                               ByVal e As System.EventArgs) Handles btnDisplay.Click
    Dim query = From country In MEGACITIESDataSet.Countries
                Where country.name = txtName.Text
                Select country.name, country.pop2010, country.monetaryUnit
    If query.Count = 1 Then
      dgvOutput.DataSource = query.ToList
      dgvOutput.CurrentCell = Nothing
    Else
      MessageBox.Show("Country is not in table.", "Not Found")
      txtName.Clear()
      txtName.Focus()
    End If
  End Sub

End Class
