private void button1_Click(object sender, EventArgs e) { string Date = textBox2.Text; string Age = textBox1.Text; string Sex = comboBox2.Text; string Country = comboBox1.Text; if (dateCheck(Date)) { if (ageCheck(Age)) { string Ret = "Update Data Point: " + ID + "," + Date + "," + Country + "," + Sex + "," + Age; Parent.CommunicateParent(Ret); Parent.updateRow(Int32.Parse(ID), Date, Country, Sex, Age); this.Close(); } else { MessageBox.Show("Invalid Age"); } } else { MessageBox.Show("Invalid Date"); } }
private void button1_Click(object sender, EventArgs e) { int PointID = ++Parent.Parent.TotalPointNum; string Date = textBox2.Text; string Age = textBox1.Text; string Sex = comboBox2.Text; string Country = comboBox1.Text; if (dateCheck(Date)) { if (ageCheck(Age)) { string Ret = "New Data Point: " + Date + "," + Country + "," + Sex + "," + Age; Parent.CommunicateParent(Ret); Parent.addRow(PointID, Date, Country, Sex, Age); COVIDDataPoint newPoint = new COVIDDataPoint(); newPoint.ID = PointID; newPoint.Date = Date; newPoint.Country = Country; newPoint.Sex = Sex; newPoint.Age = Age; Parent.Parent.Result.Add(newPoint);; this.Close(); } else { MessageBox.Show("Invalid Age"); } } else { MessageBox.Show("Invalid Date"); } }