private void displayUpdate() { CSV csv = new CSV(); string[] stringArray = (string[])csv.Read().ToArray(typeof(string)); // Get current date. DateTime thisDay = DateTime.Today; // Display the date in a variety of formats. int i = 0; foreach (string s in stringArray) { string[] individ = s.Split(','); itemName = individ[0]; string[] temp = individ[1].Split('/'); DateTime now = DateTime.Today; int age = now.Year; itemDoB = Convert.ToString(age - Convert.ToInt32(temp[2])); itemSex = individ[2]; itemEvent = individ[3]; itemLocation = individ[4]; listView1.Items.Add(new ListViewItem(new string[] { itemName, itemDoB, itemEvent })); if (itemSex.CompareTo("M") == 0) { listView1.Items[i].SubItems[0].BackColor = Color.LightSteelBlue; } else { listView1.Items[i].SubItems[0].BackColor = Color.Thistle; } i++; } }
private void OP_setUpOpen() { string OP_itemName, OP_itemDoB, OP_itemSex, OP_itemEvent, OP_itemLocation; CSV csv = new CSV(); string[] stringArray = (string[])csv.Read().ToArray(typeof(string)); // Get current date. DateTime thisDay = DateTime.Today; // Display the date in a variety of formats. int i = 0; foreach (string s in stringArray) { string[] individ = s.Split(','); OP_itemName = individ[0]; string[] temp = individ[1].Split('/'); DateTime now = DateTime.Today; int age = now.Year; OP_itemDoB = Convert.ToString(age - Convert.ToInt32(temp[2])); OP_itemSex = individ[2]; OP_itemEvent = individ[3]; OP_itemLocation = individ[4]; OPlistView1.Items.Add(new ListViewItem(new string[] { OP_itemName, OP_itemDoB, OP_itemEvent })); if (OP_itemSex.CompareTo("M") == 0) { OPlistView1.Items[i].SubItems[0].BackColor = Color.LightSteelBlue; } else { OPlistView1.Items[i].SubItems[0].BackColor = Color.Thistle; } i++; } //show DATETIMEPICKER to show the years view first //dateTimePicker1.Value = DateTime.Now; }
private void button1_Click(object sender, EventArgs e) { this.Hide(); //gets the index's of all the selected files in the ListView1 List<string> w = new List<string>(); foreach (ListViewItem item in listView1.SelectedItems) { w.Add(item.SubItems[0].Text+"/"+item.SubItems[2].Text); } //writes the CSV string to a new List using the index's of the selected items CSV csv = new CSV(); string[] stringArray = (string[])csv.Read().ToArray(typeof(string)); foreach (string itemSelectedinLV in w) { foreach (string s in stringArray) { string[] individ = s.Split(','); itemName = individ[0] + "/" + individ[3]; if (itemName.CompareTo(itemSelectedinLV) == 0) { selectedItemsR.Add(s); break; } } } oButtonB = true; }
private void OP_GetDataOffList() { string itemName; //gets the index's of all the selected files in the ListView1 List<string> w = new List<string>(); foreach (ListViewItem item in OPlistView1.SelectedItems) { w.Add(item.SubItems[0].Text + "/" + item.SubItems[2].Text); } //writes the CSV string to a new List using the index's of the selected items CSV csv = new CSV(); string[] stringArray = (string[])csv.Read().ToArray(typeof(string)); foreach (string itemSelectedinLV in w) { foreach (string s in stringArray) { string[] individ = s.Split(','); itemName = individ[0] + "/" + individ[3]; if (itemName.CompareTo(itemSelectedinLV) == 0) { OP_selectedItemsR.Add(s); break; } } } }