如何将列表框中的当前项目移动到第一个位置 [英] how to move the currently item in the listbox to first position
本文介绍了如何将列表框中的当前项目移动到第一个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
i希望将我在列表框中添加的最后一项移动到第一个位置
i尝试像这样lst_absent.Items.MoveCurrentToFirst();
但它不会起作用。
如果有任何想法怎么做就给出示例代码。
解决方案
< blockquote>您好,
每当您需要在特定位置添加项目时,您还可以在添加项目时传递索引
// public void Insert(int index,Object item)
// example
listBox1.Items.Insert( 0 , 此处的新项目) ;
我可以看到无效的原始代码吗?更具体的要求
hi
i want to move the last item i added in the listbox to the first position
i tried like this lst_absent.Items.MoveCurrentToFirst();
but it will not work .
if any have any idea how to do it give sample code.
解决方案
Hello,
Whenever you need to add item on specific position you can also pass index while adding item
//public void Insert(int index, Object item) // example listBox1.Items.Insert(0, "New Item here");
Can I see the original code that is not working? and more specific your requirement
这篇关于如何将列表框中的当前项目移动到第一个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文