?
Solved

Math problems/ operands from listbox

Posted on 2008-11-18
2
Medium Priority
?
463 Views
Last Modified: 2013-11-13
I need a code that would take numbers from a list box and solve them when i press add or multiply I have been working on this for hours and can't get it right......please help.
0
Comment
Question by:progbeginner
2 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22995409
What code do you have thus far?

mlmcc
0
 
LVL 2

Accepted Solution

by:
Rabmis earned 2000 total points
ID: 23009709
As I understand It's should be like that
        private void buttonPlus_Click(object sender, EventArgs e)
        {
            Int32 sum = 0;
            foreach (string s in listBox1.Items)
            {
                Int32 value;
                if (Int32.TryParse(s, out value))
                    sum += value;
            }
            MessageBox.Show(sum.ToString());
        }

Open in new window

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Progress
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question