title: Message Box shows when loading new windows form
body: <p>I am working on a project that lists appointments, and allows the user to add, update, or delete a selected appointment.
  When updating, and selecting the appointment to update, it opens a new window to make the changes.
  I have a messagebox nested within a try-catch block, but it still pops up when the form loads. </p>
  
  <pre><code>private void updateButton_Click(object sender, EventArgs e)
  {
      //updates the type, but for all customers with same 
      //appointment type. Work in progress.
      MySqlConnection c = new MySqlConnection(SqlUpdater.conString);
      MySqlCommand updateCmd = new MySqlCommand();
      DateTime startTime = startTimeBox.Value.ToUniversalTime();
      DateTime endTime = endTimeBox.Value.ToUniversalTime();
  
      updateCmd.Connection = c;
      c.Open();
      updateCmd.CommandText = $"UPDATE appointment SET type = @type, start = @start, end = @end WHERE customerId = @customerId";
      updateCmd.Parameters.AddWithValue("@type", typeBox.Text);
      updateCmd.Parameters.AddWithValue("@start", (DateTime)startTimeBox.Value);
      updateCmd.Parameters.AddWithValue("@end", (DateTime)endTimeBox.Value);
      updateCmd.Parameters.AddWithValue("@customerId", customerIdBox.Text);
      updateCmd.ExecuteNonQuery();
      c.Close();
  
      try
      {
          if (appHasConflict(startTime, endTime))
              throw new appointmentException();
          else
          {
              try
              {
                  if (appIsOutsideBusinessHours(startTime, endTime))
                      throw new appointmentException();
                  else
                  {
                      MessageBox.Show("Appointment Updated");
                  }
              }
              catch (appointmentException ex) { ex.businessHours(); }                
          }
      }
      catch (appointmentException ex) { ex.appOverlap(); }
  
      mainFormObject.updateCalendar();
  }
  </code></pre>
  
  <p>On the main form and update button is clicked:</p>
  
  <pre><code>private void updateAppointmentButton_Click(object sender, EventArgs e)
      {
  
          if (appointmentCalendar.SelectedRows.Count == 0)
          {
              MessageBox.Show("Please select a row to update");
          }
          else
          {
              UpdateAppointment updateAppointment = new UpdateAppointment();
              updateAppointment.mainFormObject = this;
              updateAppointment.customerIdBox.Text = appointmentCalendar.CurrentRow.Cells[0].Value.ToString();
              updateAppointment.customerNameBox.Text = appointmentCalendar.CurrentRow.Cells[1].Value.ToString();
              updateAppointment.typeBox.Text = appointmentCalendar.CurrentRow.Cells[2].Value.ToString();
              updateAppointment.startTimeBox.Value = Convert.ToDateTime(appointmentCalendar.CurrentRow.Cells[4].Value.ToString());
              updateAppointment.endTimeBox.Value = Convert.ToDateTime(appointmentCalendar.CurrentRow.Cells[3].Value.ToString());
  
              updateAppointment.Show();
          }
  
  
      }
  </code></pre>
  
  <p>The only instance of this messagebox appears within the try-catch block.</p>
  
  <p>Edit: updated the try-catch to:</p>
  
  <pre><code>if(appIsOutsideBusinessHours(startTime, endTime))
              {
              MessageBox.Show("Exception occured. Please reschedule for normal business hours.");
              return;
              }
         if(appHasConflict(startTime, endTime))
          {
              MessageBox.Show("Excepetion occured. Appointment time is already taken.");
              return;
          }
         else
          {
              MessageBox.Show("Appointment updated");
              mainFormObject.updateCalendar();
          }
  </code></pre>
  
  <p>But its still showing the appointment updated box on form load.</p>