// Update old record where Id = Id from combobox and refresh private void button1_Click(object sender, EventArgs e) { try { Squats newSq = new Squats(); Squats oldSq = new Squats(); oldSq = cmbSquat.SelectedItem as Squats; newSq.Weights = int.Parse(txtWeight.Text); newSq.Reps = int.Parse(txtReps.Text); b.AddSquat(newSq, oldSq); this.squatTableAdapter.Fill(this.baza1DataSet.Squat); textBox1.Text = b.TotalVolume().ToString(); Info(); b.SaveMaxVolume(); b.SaveMaxWeight(); textBox2.Text = b.MaxSquat().ToString(); textBox3.Text = b.GetMaxVolume().ToString(); textBox4.Text = b.GetMaxWeight().ToString(); } catch (Exception) { MessageBox.Show("Please enter a number"); } }