Difficult question
-
Dictionary list = new Dictionary(); String nameAndJob, Job, line, name; Int32 pages; ListViewItem item1; foreach (ListViewItem lvi in listView2.Items) { nameAndJob = string.Concat(lvi.SubItems[0].Text); if (!list.ContainsKey(nameAndJob)) list.Add(nameAndJob, lvi); Job = string.Concat(lvi.SubItems[1].Text); if (!list.ContainsKey(Job)) list.Add(Job, lvi); } using (StreamReader sr = new StreamReader(path1 + "/personalpr.txt")) { while (sr.Peek() > 0) { line = sr.ReadLine(); if (line == "#") { name = sr.ReadLine(); nameAndJob = string.Concat(name); Job = string.Concat(name); if (list.ContainsKey(nameAndJob)) { item1 = list[nameAndJob]; item1 = list[Job]; item1.SubItems[1].Text = sr.ReadLine(); item1.SubItems[3].Text = sr.ReadLine(); item1.SubItems[5].Text = sr.ReadLine(); } int result = 0; foreach (ListViewItem lvi in listView2.Items) { result += int.Parse(lvi.SubItems[2].ToString()) - int.Parse(lvi.SubItems[3].ToString()); ????????????????????:mad: ////I want to calculate lvi.subitems[2] - lvi.subitems[3] and pass the result to subitems[3].:mad: } item1.SubItems[3] = result.ToString();???????:mad: } } } } Can i delete this readline from .txt file after this use??? and how?? Thanks all!! :):-D;):laugh:
-
Dictionary list = new Dictionary(); String nameAndJob, Job, line, name; Int32 pages; ListViewItem item1; foreach (ListViewItem lvi in listView2.Items) { nameAndJob = string.Concat(lvi.SubItems[0].Text); if (!list.ContainsKey(nameAndJob)) list.Add(nameAndJob, lvi); Job = string.Concat(lvi.SubItems[1].Text); if (!list.ContainsKey(Job)) list.Add(Job, lvi); } using (StreamReader sr = new StreamReader(path1 + "/personalpr.txt")) { while (sr.Peek() > 0) { line = sr.ReadLine(); if (line == "#") { name = sr.ReadLine(); nameAndJob = string.Concat(name); Job = string.Concat(name); if (list.ContainsKey(nameAndJob)) { item1 = list[nameAndJob]; item1 = list[Job]; item1.SubItems[1].Text = sr.ReadLine(); item1.SubItems[3].Text = sr.ReadLine(); item1.SubItems[5].Text = sr.ReadLine(); } int result = 0; foreach (ListViewItem lvi in listView2.Items) { result += int.Parse(lvi.SubItems[2].ToString()) - int.Parse(lvi.SubItems[3].ToString()); ????????????????????:mad: ////I want to calculate lvi.subitems[2] - lvi.subitems[3] and pass the result to subitems[3].:mad: } item1.SubItems[3] = result.ToString();???????:mad: } } } } Can i delete this readline from .txt file after this use??? and how?? Thanks all!! :):-D;):laugh: