Hi All,
I have one txt there is many value but i want sum just some value like below..
i want sum below values in textbox from notepad file..
Total value: 648
Total Value: 1080
Total Value: 936
Total Value: 100
Total Value: 99
Total Value: 80
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
theLizardPosted Jun 14, 2016, 9:15 PM
{
string s;
string[] line;
int sum=0, value=0;
StreamReader sr = new StreamReader(@"c:\temp\f.txt");
while((s = sr.ReadLine()) != null)
{
line = s.Split(':');
int.TryParse(line[1].Trim(), out value);
sum += value;
}
textBox1.Text = sum.ToString();
}
Vinay SinghPosted Jun 15, 2016, 5:28 AM