Exemplo n.º 1
0
 //
 //Capture section Code
 //
 private void SubmitButton_Click(object sender, EventArgs e)
 {
     CheckValues();
     if (valuesGood == true && cityBox.Text != "")
     {
         //Add values to relevant arrays if data is input correctly
         if (cityBox.Items.Contains(cityBox.Text))
         {
             Weather.AddCityName(cityBox.Items[cityBox.Items.IndexOf(cityBox.Text)]);
         }
         else
         {
             Weather.AddCityName(cityBox.Text);
         }
         Weather.AddWeatherDate(dateInputBox.Value);
         Weather.AddMinTemp(minTempBox.Text);
         Weather.AddMaxTemp(maxTempBox.Text);
         Weather.AddPrecipitation(precipBox.Text);
         Weather.AddHumidity(humidBox.Text);
         Weather.AddWindSpeed(windBox.Text);
         Weather.AddWeatherDatabase();
         MessageBox.Show("Data Captured Successfully.");
     }
     else
     {
         MessageBox.Show("The data you have entered is incorrect. \nPlease make sure that: \n- No fields are empty.\n- There are no numbers in the city input field.\n- There are no letters in the in the number fields.");
     }
 }