Skip to content

Why my combobox doesnt make calcul in the appropriate event

Israel

Asked Jul 2, 2015, 7:07 AM EDT1 answer
Share
LinkedInX
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???
 
C#
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;
            }
 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    Hi!
     
    Dont worry I resolv it. Its was my own mistake.
     
    Thanx! 
    +1