private void btnAddAuto_Click(object sender, EventArgs e)
        {
            TVProgram program = new TVProgram();
            TV        tv      = cbTVS.SelectedItem as TV;

            program.Name     = tbName.Text;
            program.Duration = (int)nudDuration.Value;
            tv.Program.Add(program);
            fillList();
            tbName.Clear();
            nudDuration.Value = 30;
            calculate();
        }
 private void calculate()
 {
     if (lbProgram.Items.Count > 0)
     {
         double sum = 0;
         for (int i = 0; i < lbProgram.Items.Count; i++)
         {
             TVProgram a = lbProgram.Items[i] as TVProgram;
             sum += a.Duration;
         }
         tbAverage.Text = string.Format("{0:0.0}", sum / lbProgram.Items.Count);
     }
     else
     {
         tbAverage.Clear();
     }
 }