检测重复条目,列表视图?
我有一个列表视图,用户可以在其中浏览程序集,问题是用户可以从对话框中添加相同的条目。这是没有用的,不解释任何事情,那么我怎样才能摆脱这个呢?
我的问题是,如何与列表视图中的项目进行比较,以便排除这种情况。是的!已经有一个关于此的问题,但两个答案都没有帮助。
我只需要指导,因为我在网上找不到很多好的例子。
谢谢
I have a listview in which a user can browse for assemblies, the problem is that the user can add the same entry from the dialogbox. This is useless and does not account for anything, so how can i get rid of this?
My question is, how does one compare with the item in the listview so that it does rule this out. Yes! There has already been a question about this but neither of the answers helped.
I just need guidance, as I can't find many good examples on the net.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 LINQ:
You can use LINQ:
我基本上会保留您已经拥有的内容,但不会抛出错误,而是不会添加它并将现有项目移动到列表框的顶部(或底部)。这并不是一个错误。更像是他们找不到他们想要的东西,所以他们添加了一个新的。
I would basically keep what you already have but instead of throwing an error I would just not add it and move the existing item to the top (or bottom) of the ListBox. It's not really an error; it's more like they can't find what they were looking for so they added a new one.