Exemplo n.º 1
0
 private void buttonDisplayAllStations_Click(object sender, EventArgs e)
 {
     try
     {
         dataGridViewCourses.DataSource = Stations.GetAllStations(_sqlConnection);
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
 private void tabControl2_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 2)
     {
         try
         {
             comboBoxCityA.Items.Clear();
             comboBoxCityB.Items.Clear();
             var stations = Stations.GetAllStations(_sqlConnection);
             for (int i = 0; i < stations.Rows.Count; i++)
             {
                 comboBoxCityA.Items.Add(stations.Rows[i][1].ToString());
                 comboBoxCityB.Items.Add(stations.Rows[i][1].ToString());
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message);
         }
     }
 }