-1

我想要 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";
    }
}
4

1 回答 1

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";
    }
}
于 2015-07-23T16:02:31.890 回答