Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

C# if statement help

$
0
0

I am stucked with if --- else condition i dont know where my code goes wrong, i googled but couldnt get any help. the first If condition works fine but the rest else if doesnt work on run time, below is my coding, any help would be appreciated thnx

  private void button1_Click(object sender, EventArgs e)

        {

            float PremiumCost = float.Parse(txtPremiumCost.Text);

            float LoadingAmount = float.Parse(txtLoadingAmount.Text);

            float PremiumFronting = float.Parse(txtPremiumFrontingFee.Text);

            float ChargedStatusAmount = float.Parse(txtChargedStatusAmount.Text);

            float RcvBrokerageAmount = float.Parse(txtNCBBrokerageAmount.Text);

            float NetReceivable = 0;

                {

                    if (radioButton1.Checked == true || radioButton4.Checked == true)

                    {

                        NetReceivable = PremiumCost + LoadingAmount + PremiumFronting;

                    }

                    else if (radioButton2.Checked == true)

                    {

                        NetReceivable = PremiumCost + LoadingAmount + PremiumFronting + ChargedStatusAmount;

                    }

                    else if (radioButton1.Checked == true)

                    {

                    NetReceivable = PremiumCost + LoadingAmount + PremiumFronting - ChargedStatusAmount;

                    }

               

                }

                txtNetReceivable.Text = NetReceivable.ToString("N2");

            }


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>