我该如何在C#中执行此操作?有人能帮我吗

本文关键字:操作 执行 | 更新日期: 2023-09-27 18:23:47

如何在C#中执行此操作

if txtbxquantity.text <=5     
then    
    txtbxhighlowitem.text = low item    
else    
    txtbxhighlowitem.text = high item    
end if    

我该如何在C#中执行此操作?有人能帮我吗

也许你想做下一步:

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;
    }

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