我有一个组合框并且有一个列表中的东西......列表中的东西数量没有设置.它正在从文件夹中收集数据,你可以在组合框中有无限的(有点夸张)数量的项目...我怎么知道用户选择哪个选项?
我尝试了下面的代码,但它不起作用.我是C#的新手,不知道我做错了什么.
comboBox1.SelectedIndex = 0;
comboBox1.Refresh();
if(comboBox1.SelectedIndex = 0)
{
//setting the path code goes here
}
Run Code Online (Sandbox Code Playgroud)
要比较C#中的值,您需要使用"=="而不是"="
if(comboBox1.SelectedIndex == 0)
{
//setting the path code goes here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1200 次 |
| 最近记录: |