首页 > 解决方案 > Visual Studio 中的 C# 问题,无法单击按钮以正确执行行

问题描述

我的代码有问题

问题是每次我按下完成按钮时都没有计算我正在使用 Visual Studio 在 C# 中编码

        private void label1_Click(object sender, EventArgs e)
        {
            //Variable declaration
            int Numtckets;
            int NumberofULT = 35;
            int NumberofSLT = 55;
            int NumberofEZT = 42;
            int Total = 0;

            //Get input
            Numtckets = int.Parse(Numberoftickesearned.Text);
            //Processing
            if (RADULT.Checked == true) 
            {
                Total = NumberofULT * Numtckets;
                TotalLbl.Text = "Your total is..." + Total;
            }
            else if (RADSLT.Checked == true)
            {
                Total = NumberofSLT * Numtckets;
                TotalLbl.Text = "Your total is..." + Total;
            }
            else if (RADEZT.Checked == true)
            {
                Total = NumberofEZT * Numtckets;
                TotalLbl.Text = "Your total is..." + Total;
            }
            else if (RADULT.Checked == false && RADSLT.Checked == false && RADEZT.Checked == false)
            { 
                TotalLbl.Text = "Please enter the number of tickets" + Total;
            }


        }
    }
}

我试过编辑名称属性等,但没有成功。在我这样做之后,我仍然没有得到任何结果,任何帮助都会得到帮助。

标签: c#

解决方案


推荐阅读