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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
theLizardRank #1,079 · 1.8K reputationPosted Jun 14, 2016, 5:15 PM EDT
{
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 SinghRank #604 · 4K reputationPosted Jun 15, 2016, 1:28 AM EDT