如何在C#中执行此操作可以有人帮助我

时间:2015-11-20 09:32:38

标签: c#

如何在C#

中执行此操作
if txtbxquantity.text <=5     
then    
    txtbxhighlowitem.text = low item    
else    
    txtbxhighlowitem.text = high item    
end if    

2 个答案:

答案 0 :(得分:1)

可能你想做下一个:

int lowitem=0;
int highitem=0;
if(Convert.ToInt32(txtbxquantity.Text)<=5)
    lowitem = Covnert.ToInt32(txtbxhighlowitem.Text);
else 
    highitem = Covnert.ToInt32(txtbxhighlowitem.Text);

    private void button1_Click(object sender, EventArgs e)
    {
        string lowitem = "low item";
        string highitem = "high item";
        if (Convert.ToInt32(txtbxquantity.Text) <= 5)
            txtbxhighlowitem.Text = lowitem;
        else
            txtbxhighlowitem.Text = highitem;
    }

答案 1 :(得分:0)

if (txtbxquantity.Text <= "5")
        {
            txtbxhighlowitem.Text = "low item";
        }
        else
        {
            txtbxhighlowitem.Text = "high item";
        }