Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to capture the values from different locations and then calculate the sub total for it. this is the code I used, Help Needed. Thank u in advance.

C#
public int generateTotal(int total) {

            int subtotal=0;
            subtotal = subtotal + total;
            string dtotal = subtotal.ToString();
            lblTotal.Text = dtotal;
            return total;
        }
        public int geti1(int i){
            int j = 0;
            int tot = j + i;
            generateTotal(tot);
            return tot;
        }
        public int geti2(int i)
        {
            int j = 0;
            int tot = j + i;
            generateTotal(tot);
            return tot;
        }
        public int geti3(int i)
        {
            int j = 0;
            int tot = j + i;
            generateTotal(tot);
            return tot;
        }
        public int geti4(int i)
        {
            int j = 0;
            int tot = j + i;
            generateTotal(tot);
            return tot;
        }
        public int geti5(int i)
        {
            int j = 0;
            int tot = j + i;
            generateTotal(tot);
            return tot;
        }
Posted

1 solution

Even if this look syntactically correct, this code have no tail, no head.

There is no correction to do to your code, throw it away and start again from scratch.

Advice:
- You need to find some tutorials to learn how things are done.
- reading the language documentation will not harm.
- Learn an analyse method.

Sorry no more help for you, at least not with this code.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900