从 ListView 中删除项目时,如何在 VB.NET 中突出显示替换它的项目?
我的项目中有一个 ListView,它动态添加/编辑/删除项目。当用户删除某个项目时,我希望突出显示替换已删除项目的项目。我尝试简单地存储已删除项目的索引,然后突出显示该项目(list.Items(index).Selected = True
)。除非删除的项目是 ListView 中的最后一个项目(字面上和顺序上),否则这种方法效果很好。我今天遇到了逻辑问题,无法完全编写出检查此类情况的代码。
有人可以帮助我吗?我觉得自己非常愚蠢,但今天我的大脑崩溃了。
I have a ListView in my project that has dynamically added/edited/deleted items. When the user deletes an item, I want the item that replaces the deleted item to be highlighted. I tried simply storing the deleted item's index then highlighting the item there (list.Items(index).Selected = True
). This works well unless the item deleted was the last item in the ListView (both literally and sequentially). I'm having issues today with logic and can't quite come up with code that checks for these kinds of cases.
Could anyone help me? I feel incredibly stupid but my brain just falls apart today.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)