private void button4_Click(object sender, EventArgs e) { Classinfo Calculate = new Classinfo(this.updateID, this.comboBox2.SelectedItem.ToString(), this.textBox2.Text, this.comboBox1.SelectedItem.ToString(), this.numericUpDown3.Value, this.dateTimePicker1.Value.ToLongDateString() + " " + this.dateTimePicker1.Value.ToLongTimeString()); this.athlete.Add(Calculate); this.updateID++; this.DisplayObject(); }
public void DisplayObject() { listBox1.Items.Clear(); foreach (object c in athlete) { Classinfo calculate = c as Classinfo; if (calculate != null) { listBox1.Items.Add("WarmUps:" + calculate.wup + "Location:" + calculate.locat + "Activity:" + calculate.actv + "Distance:" + calculate.dis + "Time & Date :" + calculate.dt); Array_Length++; } } }
private void button5_Click(object sender, EventArgs e) { this.listBox1.Items.Clear(); if (this.comboBox4.SelectedIndex >= 1) { foreach (object search in this.athlete) { Classinfo Calculate = search as Classinfo; if (Calculate.actv == this.comboBox4.Items[this.comboBox4.SelectedIndex].ToString()) { if (Calculate != null) { this.listBox1.Items.Add(string.Concat(new object[] { "Activity:", Calculate.actv, })); } } } } else { foreach (object search in this.athlete) { Classinfo Calculate = search as Classinfo; this.listBox1.Items.Add(string.Concat(new object[] { "UpdateId:", Calculate._up, "WarmUps:", Calculate.wup, "Location:", Calculate.locat, "Activity:", Calculate.actv, "Distance:", Calculate.dis, "Time & Date :", Calculate.dt })); } } }
private void button3_Click(object sender, EventArgs e) { int updrow = this.listBox1.SelectedIndex; Classinfo Calculate = new Classinfo(this.updateID, this.comboBox2.SelectedItem.ToString(), this.textBox2.Text, this.comboBox1.SelectedItem.ToString(), this.numericUpDown3.Value, this.dateTimePicker1.Value.ToLongDateString() + " " + this.dateTimePicker1.Value.ToLongTimeString()); this.listBox1.Items[updrow] = string.Concat(new object[] { "UpdateId:", Calculate._up, "WarmUps:", Calculate.wup, "Location:", Calculate.locat, "Activity:", Calculate.actv, "Distance:", Calculate.dis, "Time & Date :", Calculate.dt }); }