注册 登录
编程论坛 C# 论坛

c# 检测到无法访问的代码 (CS0162) 怎么处理是怎么回事,求大佬们解答啊

大白小白 发布于 2019-03-23 17:26, 2619 次点击

{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
        
        void Button1Click(object sender, EventArgs e)
        {
            double d=0;
            string b=textBox2.Text.ToString();
            double a=double.Parse(textBox1.Text);
            double c=double.Parse(textBox3.Text);

            if("b"=="+")
                d=a+c;
            else if("b"=="-")
                d=a-c;
            else if("b"=="*")
                d=a*c;
            else if("b"=="/")
                d=a/c;
            else
            MessageBox.Show("亲,超出我的能力范畴了哦!","这是一个弱弱的的警告yeah~!");
            textBox4.Text=d.ToString();
        }
    }
}
只有本站会员才能查看附件,请 登录
1 回复
#2
zbjzbj2019-03-23 22:42
            if (b == "+")
                d = a + c;
            else if (b == "-")
                d = a - c;
            else if (b == "*")
                d = a * c;
            else if (b == "/")
                d = a / c;
            else
1