在组合框中隐藏项目 [英] Hide item in combobox

查看:135
本文介绍了在组合框中隐藏项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

vs2005 -vb

我有一个组合框,可以通过调用db获取其值。我已经以编程方式添加了框的列表值,以匹配可以从DB中提取的所有可能值。用户可以更新这些值并更新db条目。

我希望能够显示db中的任何条目,但是,列表中有一个我不希望用户访问的值能够将组合框的值更改为。当列表下拉时,我希望有一些方法可以"隐藏"或".visible = false"只有这一项,因此用户无法选择该值。

该框位于数据网格视图。我意识到我可以使用'cellbeginedit'& 'cellendedit'事件是为了防止这种行为,但我认为这是最后的手段,因为我认为在下拉列表中没有显示它是优选的代码方式。有什么建议?谢谢 -

jr

解决方案

尝试删除它:





Code Snippet

vs2005 -vb

I have a combobox that gets its values from a call to the db. I have programatically added the list values for the box to match all the possible values that could be pulled from the DB. The user can update these values and update the db entry.

I would like to be able to display any entries from the db, however, there is one value on the list that I don't want the user to be able to change the combobox's value to. I'm hoping there is some way to to 'hide' or '.visible=false' for just this one item when the list drops down so the user can't select that value.

The box sits in a datagridview. I realize I could use the 'cellbeginedit'  & 'cellendedit'  events to prevent this action, but I consider that to be a last resort, as I think not showing it on dropdown is preferable code-wise. Any suggestions? Thanks-

jr

解决方案

Try removing it:

Code Snippet


这篇关于在组合框中隐藏项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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