amber

amber

  • NA
  • 39
  • 48.2k

Calculated Amount becomes Zero at runtime in C# winform app.

Oct 20 2013 3:51 PM
Hi,
The code m using is:
long eval;

public long Evaluate()
        {
            k = (scor * 2);
            eval = ((k / 100) * 103228);
            return eval;
        }
on Btn_Evaluate event :

        private void button7_Click(object sender, EventArgs e)
        {
            Evaluate();
            MessageBox.Show("Percentage Proposed: " + k + "%" + "\nAmount: " + eval);

        }
it shws the eval = 0 everytime i run it but its calculating the percentage proposed "k" correctly.May b m making some silly mistake can anyone help me wd this?? first i click on score btn wich calculates the score and store it in above mentioned "scor" variable then participate in evaluate method is it the right way to do??:

on btn_score:

private void button11_Click(object sender, EventArgs e)
        {
           
            score();
            if (textBox1.Text != "")
            {
                MessageBox.Show("The Score is: " + scor);
            }
        }
Thanx in advance

Answers (5)