Calculate with decimal numbers

  • Thread starter Thread starter Inspectah84
  • Start date Start date
I

Inspectah84

Guest
i got a Problem, Need bit help..

i have 2 progressbars, both values get sets by other functions (that works).. one of both (values) represent the actual 100%, the other one represent value in % of that first progressbar value.. its change the value all the time. but for now lets give them fix values of 50 / 20..

i want calculate now (50 / 100) * 20 or (progressBar1.Value / 100) * progressBar2.Value.. that give me 0 as Output, because 50/100 ist 0.5, and ist give me 0 out there, 0x20 is still 0.. how i can do that?


small example with button :

private void button1_Click(object sender, EventArgs e)
{
Int32 VarA = (progressBar1.Value / 100) * progressBar2.Value;
string VarB = VarA.ToString();
label1.Text = VarB;
}


i tryed it with float, double, and short.. all same result

Continue reading...
 
Back
Top