Israel

Israel

  • 699
  • 1.3k
  • 215.6k

Why my combobox doesnt make calcul in the appropriate event

Jul 2 2015 11:07 AM
Hi!
 I wrote this code and I need to make this operation when I select the first value. But its doesnt make nothing. It works only when I put it this code on a button. I am asking now the question to know if its in a wrong event???
 
switch (cbxPercentagemFacturacao.SelectedIndex)
{
case 0:
decimal d1, d2, total;
decimal.TryParse(cbxPercentagemFacturacao.Text, out d1);
decimal.TryParse(txtTotal2.Text, out d2);
total = d1 * d2 / 100;
txtValor3.Text = total.ToString("N");
txtTotal3.Text = "";
break;
case 1:
MessageBox.Show("test1");
break;
default:
MessageBox.Show("test2");
break;
}
 
 

Answers (1)