【发布时间】:2016-10-15 19:02:28
【问题描述】:
我正在编写一个引用状态的简单程序 SelectedIndex 在任何给定点都可以是数字 0 - 9
SelectedIndex 由下拉列表控制。
当我尝试引用 SelectedIndex 的状态时:
if (SelectedIndex == 0)
{
textBox1->Text = "C Egyptian";
}
编译时出现“未声明的标识符”错误。
我只想能够为我的条件引用状态 SelectedIndex。
有什么想法吗?
【问题讨论】:
-
只是不在您使用它的特定范围内
-
dropdownlist->SelectedIndex?这里只是猜测。 minimal reproducible example 请。 -
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { if (sender == comboBox1) { String^ ps = String::Concat(L"新索引为 ", (Object^)(comboBox1->SelectedIndex).ToString()); MessageBox::Show(ps, L"索引变化"); } }
-
@CyberneticJesus 请在您的问题中添加此类附加信息。