【问题标题】:How can hide or visible false an item from Combo Box in c#?如何在 C# 中的 Combo Box 中隐藏或显示 false 项目?
【发布时间】:2018-10-26 12:55:20
【问题描述】:

如何在 c# windows 窗体中从 Combo Box 中隐藏或显示 false 项目? 我在事件 selectedIndexChange 中尝试了此代码

Switch (myComboBox.selectedIndex)
{
     Case 0:
         Visible=false;
      break;
}

【问题讨论】:

标签: c# winforms combobox


【解决方案1】:

隐藏组合框中的项目

// keep the items in a list
List<string> list = new List<string>();
list.Add("city");

// remove them from combobox
comboBox1.Items.Remove("city");

// if you want to add them again.
comboBox1.Items.Add(list[0]);

【讨论】:

  • 此代码用于启用项目,而不是用于隐藏或可见的假项目。
  • 我在c#winform中使用这个控件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-20
相关资源
最近更新 更多