private void btnDelete_Click(object sender, EventArgs e) // done { ListView.CheckedIndexCollection checkeditem = listView4.CheckedIndices; while (checkeditem.Count > 0) { listView4.Items.RemoveAt(checkeditem[0]); } children.Clear(); int count = 0; foreach (ListViewItem i in listView4.Items) { string Name = listView4.Items[count].SubItems[0].Text; DateTime DOB = Convert.ToDateTime(listView4.Items[count].SubItems[1].Text); string Fact = listView4.Items[count].SubItems[2].Text; ChildDetails new_Child = new ChildDetails(Name, DOB, Fact); children.Add(new_Child); count++; } }
private void btnAdd_Click(object sender, EventArgs e) //done { ChildDetails c = new ChildDetails(txtName.Text, dateTimePicker1.Value, txtFact.Text); // get info entered in the fields children.Add(c); // adds new child to children collection MessageBox.Show("New child added to system!", "Success!"); listUpdate(listView2); }
private void LoadChildren() //Function that loads in the data { children.Clear(); // clears listview before List <string> data = File.ReadAllLines("lab03input.txt").ToList(); // reads in data from text file line by line foreach (string line in data) //loop through the members in the file and write them into a list of tyoe ChildDetails { string[] info = line.Split('-'); ChildDetails child = new ChildDetails((info[0].Trim()), DateTime.Parse(info[1].Trim()), info[2].Trim()); children.Add(child); //Add them all to the children collection } }
private void btnLoad_Click(object sender, EventArgs e) // done { children.Clear(); // clears listview before List <string> data = File.ReadAllLines("lab03input.txt").ToList(); // reads in data from text file line by line foreach (string line in data) //loop through the members in the file and write them into a list of tyoe ChildDetails { string[] info = line.Split('-'); ChildDetails child = new ChildDetails((info[0].Trim()), DateTime.Parse(info[1].Trim()), info[2].Trim()); children.Add(child); //Add them all to the children collection } tabControl1.SelectedIndex = 0; tab0(); }