清除 C# 中的下拉列表 [英] Clearing a drop down list in C#

查看:36
本文介绍了清除 C# 中的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很讨厌问这样一个蜡笔问题...我试图清除,而不是删除 VSC# 中的下拉组合列表.我的 ddl 允许用户选择员工的 payRate.我到处都研究过,甚至在这里,一切都建议使用..

I truly do hate to ask such a crayon-question... I'm trying to clear, not remove a drop down combo list in VSC#. My ddl lets the user choose the payRate of an employee. I've researched everywhere, even here, and everything suggests using..

   cmboPayRate.Items.Clear();   .. or
   cmboPayRate.SelectedIndex = - 1;

我什至投入了

cmboPayRate.SelectedItem = -1;   

为了安全措施.没有任何作用.同样,我知道这很容易(应该),但对我不起作用.任何建议将不胜感激.

for safe measure. Nothing working. Again, I know this is easy(should be), but not working for me. Any suggestions would be greatly appreciated.

谢谢-马特.

推荐答案

try

DropDownList1.Items.Clear(); 

没有隐藏和清除下拉列表.

No hidden and clear the Drop Down List.

这篇关于清除 C# 中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆