C ++ Builder XE8中的简单代码

时间:2015-07-23 06:38:58

标签: c++builder-xe8

我想要C ++ Builder XE8的代码

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    var str = listBox1.SelectedItem.ToString();
    if (str == "A")
    {
        textBox1.Text = "You have selected A";
    }

    else if (str == "B")
    {
        textBox1.Text = "You have selected B";
    }
    else
    {
        textBox1.Text = "You have not selected A or B";
    }
}

1 个答案:

答案 0 :(得分:0)

也许下面的C ++ Builder可能是这样的:

private:
void listBox1_SelectedIndexChanged(void *sender, EventArgs *e)
{
    auto str = listBox1::SelectedItem->ToString();
    if (str == "A")
    {
        textBox1->Text = "You have selected A";
    }

    else if (str == "B")
    {
        textBox1->Text = "You have selected B";
    }
    else
    {
        textBox1->Text = "You have not selected A or B";
    }
}