15,905,238 members
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

## Solution 1

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.

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

Top Experts
Last 24hrsThis month
 Dave Kreskowiak 60 Member 10618553 -6 Sanjeev Jyothikrishnan -16
 Pete O'Hanlon 1,740 OriginalGriff 1,307 Richard Deeming 550 Dave Kreskowiak 475 Richard MacCutchan 355

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